SetRankingMode

SetRankingMode

Prototype: function SetRankingMode ( $ranker, $rankexpr=“” )

Sets ranking mode (aka ranker). Only available in SPH_MATCH_EXTENDED matching mode. Parameter must be a constant specifying one of the known rankers.

By default, in the EXTENDED matching mode Sphinx computes two factors which contribute to the final match weight. The major part is a phrase proximity value between the document text and the query. The minor part is so-called BM25 statistical function, which varies from 0 to 1 depending on the keyword frequency within document (more occurrences yield higher weight) and within the whole index (more rare keywords yield higher weight).

However, in some cases you'd want to compute weight differently - or maybe avoid computing it at all for performance reasons because you're sorting the result set by something else anyway. This can be accomplished by setting the appropriate ranking mode. The list of the modes is available in the section called “Search results ranking”.

$rankexpr argument was added in version 2.0.2-beta. It lets you specify a ranking formula to use with the expression based ranker, that is, when $ranker is set to SPH_RANK_EXPR. In all other cases, $rankexpr is ignored.

News
Downloads
Services
Community
Resources
About