在 Solr 中,当使用 solr.ShingleFilterFactory 合并令牌时,它可能会根据 min/maxShingleSize 和要合并的令牌生成多个 Shingle。因此,搜索失败。如何将多个令牌合并为一个以便我的搜索工作。这是我的设置:
<fieldType name="text_ngram" class="solr.TextField">
<analyzer type="index">
<charFilter class="solr.PatternReplaceCharFilterFactory" pattern="\b \b" replacement=""/>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"/>
<filter class="solr.ShingleFilterFactory" tokenSeparator="" minShingleSize="2" maxShingleSize="7" outputUnigrams="false"/>
<filter class="solr.LengthFilterFactory" min="6" max="7"/>
</analyzer>
</fieldType>
这是查询 name_ngram 的调试输出:“our G20 9NS”
"debug": {
"rawquerystring": "name_ngram:\"our G20 9NS\"",
"querystring": "name_ngram:\"our G20 9NS\"",
"parsedquery": "PhraseQuery(name_ngram:\"rg209ns g209ns\")",
"parsedquery_toString": "name_ngram:\"rg209ns g209ns\"",
"explain": {},
提前感谢,