我想使用tsvector进行全文搜索。 我有查询:
$queryBuilder->select('c')
->from(Campaign::class, 'c', 'c.id')
->where('c.user_id = :user_id AND c.tsv @@ to_tsquery(\'english\', \':vector\')')
->setParameter('user_id', $userEntity->getId())
->setParameter('vector', $request->get('s'))
->getQuery()
->getResult()
结果:
Error: Expected =, <, <=, <>, >, >=, !=, got '@'
我该如何解决这个问题?
答案 0 :(得分:0)
我相信默认情况下,Doctrine没有这样的lexem。您可以做的是创建自定义类型。检查文档:
http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#custom-mapping-types http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types
这也是git上 tsvector 的一个例子: https://gist.github.com/darklow/3129096