感谢您花时间阅读此内容 .
我使用solr 6让荧光笔与EdgeNGramFilterFactory一起工作,问题是solr返回匹配的术语,当我想要它做的是突出显示匹配的术语中的字符 .
返回的结果如下所示:
<em>Welcome</em>
到了丛林
我希望它们看起来像是这样的:丛林中的 <em>Wel</em>come
在我的架构中:
<fieldtype name="text" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="10"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldtype>
<field name="document" type="text" indexed="true" stored="true"/>
1 回答
Solr
返回高亮显示的文本,该文本存储在Solrenter code here
index中 .通过使用索引时使用的
analyser
来完成的索引术语如Wel
在任何响应中都不会返回 .作为回应,如果您为同一字段选择了
stored=true
,则会收到原始文本 .因此即使它与术语
Wel
匹配,它也会在突出显示中返回原始术语/文本 .