1
我试图让全文搜索按照 Doctrine_RawSql查询中的相关性进行排序。如何使用Doctrine_RawSql进行全文搜索和按相关性进行排序
此代码将执行搜索:
$q = new Doctrine_RawSql();
$q->select('{p.*}')
->from('cms_page p')
->where('match(p.content) against (?)', $user_query)
->addComponent('p', 'CmsPage p');
这将执行。我想结果按相关性
排序真正的SQL都必须看起来像:
select
p.id,
match(p.content) against (?) as score
from
cms_page as p
order by
score desc;
所以我需要那场比赛......对条款的选择...我认为。在完成这个
我crapshoot的猜测是:
$q->select("{p.id}, match({p.content}) against ('$escaped_user_query') as score")
->from('cms_page p')
->orderBy('score DESC')
->addComponent('p', 'CmsPage p');
这是行不通的。任何指针?
在此先感谢!