DocumentWeightingRules
TextSearchおよび関連関数のオプションで,検索指標内のフィールドの値に基づいてドキュメントの重みを指定できるようにする.
詳細
- DocumentWeightingRules -> <|"field1" -> <|val11 -> weight11, val12 -> weight12, …|>, "field2" -> <|…|>, …|>は,フィールド"fieldi"内の値 valijを持つドキュメントのスコアが weightij倍されることを意味する.
- DocumentWeightingRulesに使われるフィールドの"Stored"オプションまたは "BulkRetrievalOptimized"オプションは,ContentFieldOptionsでTrueに設定されていなければならない.
- パフォーマンスのために,"BulkRetrievalOptimized"は"Stored"であることが望ましい.
例題
すべて開く すべて閉じる例 (1)
"Quality"フィールドの値に基づいてドキュメントに重みを付ける:
index = CreateSearchIndex[{
ContentObject[<| "Text" -> "orange", "Title" -> "doc1", "Quality" -> "high"|>],
ContentObject[<| "Text" -> "orange", "Title" -> "doc2", "Quality" -> "low"|>]
},
ContentFieldOptions -> <|"Quality" -> <|"BulkRetrievalOptimized" -> True|>|>,
DocumentWeightingRules -> <|"Quality" -> <|"high" -> 2, "low" -> 0.5|>|>]TextSearch[index, "orange"][All, {"Title", "Score"}]index = CreateSearchIndex[{
ContentObject[<| "Text" -> "orange", "Title" -> "doc1"|>],
ContentObject[<| "Text" -> "orange", "Title" -> "doc2"|>]
}]TextSearch[index, "orange"][All, {"Title", "Score"}]考えられる問題 (2)
ドキュメントの重み付けは,ファイルではなく索引について計算しているときにのみ適用される:
TextSearch["ExampleData/Text", "dog", DocumentWeightingRules -> {"Quality" -> {"high" -> 2, "low" -> .3}}][1, "Score"]ドキュメントの重み付けに使われるフィールドの"Stored"または"BulkRetrievalOptimized"は,索引のContentFieldOptionsでTrueに設定されていなければならない:
index = CreateSearchIndex[{
ContentObject[<| "Text" -> "orange", "Title" -> "doc1", "Quality" -> "high"|>],
ContentObject[<| "Text" -> "orange", "Title" -> "doc2", "Quality" -> "low"|>]
}]TextSearch[index, "orange", DocumentWeightingRules -> {"Quality" -> {"high" -> 2, "low" -> .3}}][All, {"Title", "Score"}]テキスト
Wolfram Research (2017), DocumentWeightingRules, Wolfram言語関数, 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_2026_documentweightingrules, author="Wolfram Research", title="{DocumentWeightingRules}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DocumentWeightingRules.html}", note=[Accessed: 08-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_documentweightingrules, organization={Wolfram Research}, title={DocumentWeightingRules}, year={2017}, url={https://reference.wolfram.com/language/ref/DocumentWeightingRules.html}, note=[Accessed: 08-September-2026]}