PHP 5.4.31 Released

SphinxClient::setRankingMode

(PECL sphinx >= 0.1.0)

SphinxClient::setRankingModeSet ranking mode

Description

public bool SphinxClient::setRankingMode ( int $ranker )

Sets ranking mode. Only available in SPH_MATCH_EXTENDED2 matching mode.

Ranking modes
Constant Description
SPH_RANK_PROXIMITY_BM25 Default ranking mode which uses both proximity and BM25 ranking.
SPH_RANK_BM25 Statistical ranking mode which uses BM25 ranking only (similar to most of other full-text engines). This mode is faster, but may result in worse quality on queries which contain more than 1 keyword.
SPH_RANK_NONE Disables ranking. This mode is the fastest. It is essentially equivalent to boolean searching, a weight of 1 is assigned to all matches.

Parameters

ranker

Ranking mode.

Return Values

Returns TRUE on success or FALSE on failure.

add a note add a note

User Contributed Notes 1 note

up
2
moosh at php dot net
1 year ago
Sphinx search support now more than  3 ranking  mode.

1) SPH_RANK_NONE ranker just assigns every document weight to 1.

2) SPH_RANK_WORDCOUNT ranker counts all the keyword occurrences and multiplies them by user field weights.

3) SPH_RANK_FIELDMASK ranker returns a bit mask of matched fields.

4) SPH_RANK_PROXIMITY, the default ranker in SPH_MATCH_ALL legacy mode, simply passes the phrase proximity for a weight.

5) SPH_RANK_MATCHANY ranker, used to emulate legacy MATCH_ANY mode, combines phrase proximity and the number of matched keywords so that, with default per-field weights, a) longer sub-phrase match (aka bigger phrase proximity) in any field would rank higher, and b) in case of agreeing phrase proximity, document with more matched unique keywords would rank higher. In other words, we look at max sub-phrase match length first, and a number of unique matched keywords second. In pseudo-code,

6) SPH_RANK_PROXIMITY_BM25, the default SphinxQL ranker and also the default ranker when “extended” matching mode is used with SphinxAPI

7) SPH_RANK_BM25 ranker sums user weights of the matched fields and BM25.

8) SPH_RANK_SPH04 ranker further improves on PROXIMITY_BM25 ranker (and introduces numbers instead of meaningful names, too, because a name would be way too complicated). Phrase proximity is still the leading factor, but, within a given phrase proximity, matches in the beginning of the field are ranked higher, and exact matches of the entire field are ranked highest.

SOURCE & Details : http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/
To Top