©
本文档使用
php.cn手册 发布
(PECL sphinx >= 0.1.0)
SphinxClient::setRankingMode — Set ranking mode
$ranker
)
Sets ranking mode. Only available in
SPH_MATCH_EXTENDED2
matching mode.
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. |
ranker
Ranking mode.
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
[#1] moosh at php dot net [2013-02-09 09:21:15]
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/