ArangoSearch Scorers
ArangoSearch Scorers are special functions that allow to sort documents from aview by their score regarding the analyzed fields.
Details about their usage in AQL can be found in theArangoSearch SORT
section.
BM25: order results based on the BM25 algorithm
TFIDF: order results based on the TFIDF algorithm
BM25() - Best Matching 25 Algorithm
IResearch provides a ‘bm25’ scorer implementing theBM25 algorithm. Optionally, freeparameters k and b of the algorithm typically using for advancedoptimization can be specified as floating point numbers.
BM25(doc, k, b)
doc (document): must be emitted by
FOR doc IN someView
k (number, optional): term frequency, the default is 1.2. k_calibrates the text term frequency scaling. A _k value of 0 corresponds toa binary model (no term frequency), and a large value corresponds to using rawterm frequency.
b (number, optional): determines the scaling by the total text length, thedefault is 0.75. b determines the scaling by the total text length.
- b = 1 corresponds to fully scaling the term weight by the total text length
- b = 0 corresponds to no length normalization.At the extreme values of the coefficient b, BM25 turns into the rankingfunctions known as BM11 (for b = 1) and BM15 (for b = 0).
TFIDF() - Term Frequency – Inverse Document Frequency Algorithm
Sorts documents using theterm frequency–inverse document frequency algorithm.
TFIDF(doc, withNorms)
- doc (document): must be emitted by
FOR doc IN someView
- withNorms (bool, optional): specifying whether norms should be used viawith-norms, the default is false