• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • SphinxClient::setRankingMode()

    (PECL sphinx >= 0.1.0)

    Set ranking mode

    说明

    publicSphinxClient::setRankingMode(int $ranker): bool

    Sets ranking mode. Only available in SPH_MATCH_EXTENDED2 matching mode.

    Ranking modes
    ConstantDescription
    SPH_RANK_PROXIMITY_BM25Default ranking mode which uses both proximity and BM25 ranking.
    SPH_RANK_BM25Statistical 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_NONEDisables 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

    参见

    • SphinxClient::setMatchMode
    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/