开发者

Zend Framework zend_db_select ORDER

    $select->where('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string);
    $select->order('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?) DESC',$searching);

Getting error:

Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound

The problem seems in the line with $select->order.

It's for relevance in results. Ho开发者_Go百科w it should look in Zend Framework?

And there seems some problem with searching. Some words it searches and some not. Why is this working that way? :Z

Thanks


I think you need to change your select statement so that the MATCH AGAINST portion is moved from the order clause and into the field list.

eg

instead of

SELECT *
FROM mytable
WHERE match(text,phone,phone2) AGAINST ('something')
ORDER BY match(text,phone,phone2) AGAINST ('something');

you would have

SELECT mytable.*, match(text,phone,phone2) AGAINST ('something') AS relevanceScore
FROM mytable
WHERE match(text,phone,phone2) AGAINST ('something')
ORDER BY relevanceScore DESC;

So, more in relation to your case your select would look something more like

$select->from('tableName',array('*','relevenceScore'=>$db->quoteInto('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string));
$select->where('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string);
$select->order('relevanceScore DESC');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜