0

Sphinxをセットアップしましたが、PHP APIの順序が返されるという問題があります。検索デーモンは正​​しい配列応答を返しますが、PHPAPIはIDの順序で返されるようです。なぜそれが次のことをしているのか誰かが知っていますか?

更新:問題が単一の単語の検索で発生しているように見えることに気づきました。たとえば、「dyspraxiaへのガイド」と入力した場合、PHP APIの結果は問題ないように見えます-なぜですか?

// running via SSH using the 'search dyspraxia' (search daemon command)
displaying matches:
1. document=5994, weight=2846, title=A guide to dyspraxia, table_id=3
2. document=3993, weight=1731, title=THE WRITE THING FOR BOYS, table_id=3
3. document=2697, weight=1668, title=SEN And Sensibility, table_id=3
4. document=3320, weight=1668, title=SEN And Sensibility, table_id=3
5. document=3810, weight=1668, title=SEN support in schools  in or out of the classroom?, table_id=3
6. document=4304, weight=1668, title=The Ukulele Strategy, table_id=3
7. document=4437, weight=1668, title=Let the future in, table_id=3
8. document=5273, weight=1668, title=Working memory is the key to learning, table_id=3
9. document=5396, weight=1668, title=Mind mapping for dyslexics, table_id=3

words:
1. 'dyspraxia': 9 documents, 27 hits

// PHP API script 
$cl = new SphinxClient();
$cl->SetServer($CONF['sphinx_host'], $CONF['sphinx_port']);
$cl->SetLimits(0, 1000);
$result = $cl->Query($q);

// returned $result['matches'] below note 2697 is first, where-as in the search daemon the first document id is 5994

Array ( 
[2697] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[3320] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[3810] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[3993] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[4304] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[4437] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[5273] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[5396] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) 
[5994] => Array ( [weight] => 1 [attrs] => Array ( [table_id] => 3 ) ) ) 
4

1 に答える 1

2

検索ツールのデフォルトはbm25ランキングのようです。$ cl-> SetMatchMode(SPH_MATCH_EXTENDED2);を追加してみてください。$ cl-> SetRankingMode(SPH_RANK_BM25); 同じ結果が得られるはずです。ところで、検索ツールをあまり信用しないでください。それはテスト用であり、Sphinxプロジェクトの「二級市民」のようなものです。APIまたはSQLインターフェースを使用します。

于 2012-10-31T19:33:36.893 に答える