Add a FULLTEXT index in Doctrine 2 using annotations?

前端 未结 2 1523
猫巷女王i
猫巷女王i 2021-02-01 18:08

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 n

相关标签:
2条回答
  • 2021-02-01 18:49

    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;
    
        ...
    }
    
    0 讨论(0)
  • 2021-02-01 18:50

    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
    
    0 讨论(0)
提交回复
热议问题