DocumentWeightingRules

DocumentWeightingRules

is an option for TextSearch and related functions that allows the specification of weights for documents based on the values of fields in the search index.

Details

  • DocumentWeightingRules -> <|"field1" -> <|val11 -> weight11, val12 -> weight12, |>, "field2" -> <||>, |> means that a document with value valij for field "fieldi" will have its score multiplied by weightij.
  • The fields used for DocumentWeightingRules need to have the "Stored" or "BulkRetrievalOptimized" option set to True in ContentFieldOptions.
  • For performance purposes, "BulkRetrievalOptimized" is to be preferred to "Stored".

Examples

open allclose all

Basic Examples  (1)

Weight documents according to the value of a "Quality" field:

Possible Issues  (2)

Document weighting only applies when searching on an index, not on files:

The fields used for document weighting must have "Stored" or "BulkRetrievalOptimized" set to True in the ContentFieldOptions of the index:

Introduced in 2017
 (11.1)