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:

Without weighting, the results have the same score:

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:

Wolfram Research (2017), DocumentWeightingRules, Wolfram Language function, https://reference.wolfram.com/language/ref/DocumentWeightingRules.html.

Text

Wolfram Research (2017), DocumentWeightingRules, Wolfram Language function, https://reference.wolfram.com/language/ref/DocumentWeightingRules.html.

CMS

Wolfram Language. 2017. "DocumentWeightingRules." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DocumentWeightingRules.html.

APA

Wolfram Language. (2017). DocumentWeightingRules. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DocumentWeightingRules.html

BibTeX

@misc{reference.wolfram_2024_documentweightingrules, author="Wolfram Research", title="{DocumentWeightingRules}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DocumentWeightingRules.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_documentweightingrules, organization={Wolfram Research}, title={DocumentWeightingRules}, year={2017}, url={https://reference.wolfram.com/language/ref/DocumentWeightingRules.html}, note=[Accessed: 22-December-2024 ]}