Reputation: 4237
Somehow, whatever the query is, Sphinx always returns results in ascending order (ordered by the primary ID). Say I'm searching for "foo" in these 5 documents:
foo bar
foo foo foo foo
ja la la
foo foo foo foo foo
foo foo foo
This would return matches: 1, 2, 4, 5 with 1 being the most relevant. At least, this is what var_dump shows me in PHP. However, I want the real order to be: 4, 2, 5, 1. How am I supposed to fix this? I'm using the following settings:
$sphinx->SetMatchMode(SPH_MATCH_ALL);
$sphinx->SetRankingMode(SPH_RANK_PROXIMITY_BM25);
$sphinx->SetSortMode(SPH_SORT_RELEVANCE);
The following source is being searched:
source pages
{
type = mysql
sql_query = SELECT text_id, book_id, content, page_number FROM text
sql_attr_uint = page_number
sql_attr_uint = book_id
sql_query_pre = SET SESSION group_concat_max_len = 4294967295
}
Upvotes: 1
Views: 293