Question

I know that Doctrine 2 doesn't support FULLTEXT indexes. I'm actually using a result set mapping and native queries to FULLTEXT search innodb tables (MySQL 5.6). But I still need to mark one or more entity fields as part of the index.

Is there any way to add the index using annotations? It seems that @Index annotation doesn't specify the type of...

Was it helpful?

Solution

According to DDC-3014 in the issue tracker of Doctrine, the possibility to specify full-text indices using annotations was implemented on April 14 and will be available in release 2.5. If you don't like to wait, you could try to use the unstable, development version or to backport the commit implementing the feature.

Here is a usage example:

/**
* @Entity
* @Table(indexes={@Index(columns={"content"}, flags={"fulltext"})})
*/
class Comment
{
    /**
    * @Column(type="text")
    */
    private $content;

    ...
}

OTHER TIPS

Here is an example how to make a fulltext index with the yaml mapping driver.

Doctrine\Tests\ORM\Mapping\Comment:
    type: entity
    fields:
        content:
            type: text
    indexes:
        xy_fulltext:
            columns: ["name", "content", "keywords"]
            flags: fulltext
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top