At times you might want to sort the results by values other than relevance. The Sphinx API provides SetSortMode($mode, $sortby="")
method which can be used to set the sort mode other than relevance, which is the default sort mode.
The following sorting modes are available in Sphinx:
SPH_SORT_RELEVANCE:
Sorts by relevance in descending order, that is, best matches firstSPH_SORT_ATTR_DESC:
Sorts by an attribute in descending order, that is, bigger attribute values firstSPH_SORT_ATTR_ASC:
Same asSPH_SORT_ATTR_DESC
, but sorts in ascending orderSPH_SORT_TIME_SEGMENTS:
Sorts by time segments (last hour/day/week/month), in descending order, and then by relevance in descending orderSPH_SORT_EXTENDED:
Sorts by SQL-like combination inASC
orDESC
order
// Sort by relevance. Second parameter is not required in this case. $client->SetSortMode(SPH_SORT_RELEVANCE); // Sort by author_id in descending order $client->...