Question

I'm using sphinx 2.1.4

I'm searching with sphinx with following methods,

First::
Using sphinxql through PDO in php using this query

SELECT * FROM $indexes WHERE MATCH(:match)  LIMIT 0,10 OPTION ranker=bm25

Now when I do the same thing with sphinxapi.php which comes along with installation, the ranking mode seems to work like SPH_RANK_MATCHANY only. Changing ranking mode through api doesn't work, it gives the same result.

Here is the api implementation::

$conn = new SphinxClient();
$conn->SetServer("192.168.x.x", 9312);

$conn->SetMatchMode(SPH_MATCH_ANY);
$conn->SetRankingMode(SPH_RANK_BM25);
$conn->SetArrayResult(true);

$rows = $conn->Query('query', 'test1');

The query methods seems to work but not the api one. I checked it several times. Is there any bug or I'm doing something wrong ?

Was it helpful?

Solution

SetRankingMode only works if you use SPH_MATCH_EXTENDED

SphinxQL is Always extended match mode - its the only one it supports (it might be possible to change the match mode via aN undocumented OPTION, but not recommended)

To be clear Match mode, and Ranking Mode are two different things. The concept of different match modes is depreciated hence not exposed in SphinxQL.

If you really want to use the API, suggest you stick to SPH_MATCH_EXTENDED - dont be tempted by the other modes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top