PHP Velho Oeste 2024

SphinxClient::setRankingMode

(PECL sphinx >= 0.1.0)

SphinxClient::setRankingModeConfigure le mode de classement

Description

public SphinxClient::setRankingMode ( int $ranker ) : bool

Configure le mode de classement. Uniquement disponible avec le mode de recherche SPH_MATCH_EXTENDED2.

Ranking modes
Constante Description
SPH_RANK_PROXIMITY_BM25 Mode de classement par défaut, avec un calcul de proximité et un tri BM25.
SPH_RANK_BM25 Mode de classement statistique, qui utilise le classement BM25 uniquement (similaire à celui de nombreux autres moteurs de recherche en texte intégral). Ce mode est plus rapide, mais peut conduire à des résultats de piètre qualité sur les requêtes qui requièrent plus d'un mot clé.
SPH_RANK_NONE Désactive le classement. Ce mode est le plus rapide. Il est essentiellement équivalent à une recherche booléenne, avec un poids de 1 associé à chaque occurrence.

Liste de paramètres

ranker

Mode de classement.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.

add a note add a note

User Contributed Notes 1 note

up
3
moosh at php dot net
11 years 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