[英]How to prefix match a doc value -> search term in lucene search engines like Solr, ElasticSearch
我們需要從<document value> -> <search term>
進行前綴匹配。 在 Solr、ElasticSearch 中可以反向,它是<search term> -> <document value>
例子:
Search term -> "traveling the world"
Document field value -> "travel"
不確定如何前綴匹配或模糊此查詢,以便我們可以獲得此文檔結果。
前綴匹配就像這樣"travel*"
搜索詞 -> "travel"
文檔字段值 -> "traveling the world"
嘗試在您的字段定義中使用 PorterStemFilterFactory。
<filter class="solr.PorterStemFilterFactory"/>
您的定義可能如下所示:
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory "/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
這是輸入,output 將是:
在: “跳跳跳跳”
要過濾的分詞器: “jump”、“jumping”、“jumped”
出: “跳”、“跳”、“跳”
還有另一種替代方法,稱為 solr.KStemFilterFactory,它的攻擊性較低。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.