开发者

Sphinx Using SPH_MATCH_ANY Ignores SetFieldWeights and SetSortMode

开发者 https://www.devze.com 2023-02-07 10:08 出处:网络
Hey guys, im trying to order my results in the way I want via sphinx 0.99, but its not working. Im currently using this

Hey guys, im trying to order my results in the way I want via sphinx 0.99, but its not working.

Im currently using this

$cl->SetMatchMode ( SPH_MATCH_ANY );
$cl->SetRankingMode ( SPH_RANK_PROXIMITY_BM25 );
$cl->SetFieldWeights ( array ( "item_title"=>100,"item_publish_date"=>99 ) );
$cl->SetSortMode ( SPH_SORT_EXTENDED  , "@weight DESC,item_publish_date DESC" );
$cl->SetLimits(0, 330);

Which pulls up all the results, but it ignores the item_publish_date value completely.

If i used SPH_MATCH_BOOLEAN isntead of SPH_MATCH_ANY, it does show the results in the order I want, but then it limits开发者_运维百科 the results too much, as similar items will be completely ignored, thats why I need to use SPH_MATCH_ANY to show the most results.

So my question is, how can i factor in item_publish_date using SPH_MATCH_ANY?


I think item_publish_date is not a text field, so you don't need to use it in SetFieldWeights method, because it's mean nothing. Second, SPH_MATCH_ANY ranker compute weight using additionally count of matching words, not only matches. Thats why you need to make some tests and watch for weight parameter in different searches.

Here is something to read about weighting in Sphinx

0

精彩评论

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