在Doctrine 2中使用注释添加FULLTEXT索引? [英] Add a FULLTEXT index in Doctrine 2 using annotations?

查看:95
本文介绍了在Doctrine 2中使用注释添加FULLTEXT索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Doctrine 2不支持FULLTEXT索引。我实际上使用结果集映射和本机查询到FULLTEXT搜索innodb表(MySQL 5.6)。但是我仍然需要将一个或多个实体字段标记为索引的一部分。



有没有办法使用注释添加索引?似乎 @Index 注释没有指定类型...

解决方案

根据 DDC-3014 在Doctrine的问题追踪器中,指定的可能性使用注释的全文索引于4月14日实施,将在2.5版中提供。如果您不喜欢等待,您可以尝试使用不稳定的开发版本或后端提交



这是一个使用示例:

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

...
}


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...

解决方案

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;

    ...
}

这篇关于在Doctrine 2中使用注释添加FULLTEXT索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆