我正在尝试实现Solr上下文过滤,以基于类别值过滤自动建议结果。自动建议已通过SpellCheckComponent
实现。
schema.xml
<field name="autosuggest" type="text_spell" indexed="true" stored="true" multiValued="true" />
<field name="autosuggest_en" type="text_spell_en" indexed="true" stored="true" multiValued="true" />
<field name="autosuggest" type="text_spell" indexed="true" stored="true" multiValued="true" />
<copyField source="autosuggest" dest="autosuggest_en" />
<fieldType name="text_spell" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
<field name="autosuggest_en" type="text_spell_en" indexed="true" stored="true" multiValued="true" />
<fieldType name="text_spell_en" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.PatternReplaceFilterFactory" pattern="(['’])" replacement=" " />
<filter class="solr.EnglishMinimalStemFilterFactory" />
<filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true" />
<filter class="solr.ManagedStopFilterFactory" managed="en" />
<filter class="solr.SynonymFilterFactory" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.ManagedSynonymFilterFactory" managed="en" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.TrimFilterFactory" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory" />
</analyzer>
</fieldType>
<dynamicField name="*_string_mv" type="string" indexed="true" stored="true" multiValued="true" />
solrConfig.xml
<searchComponent name="suggest" class="solr.SpellCheckComponent">
<lst name="spellchecker">
<str name="name">categorydic</str>
<str name="classname">org.apache.solr.spelling.suggest.Suggester</str>
<str name="lookupImpl">org.apache.solr.spelling.suggest.fst.AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">org.apache.solr.spelling.suggest.DocumentDictionaryFactory</str>
<str name="field">autosuggest_en</str>
<str name="contextField">allCategories_string_mv</str>
<str name="buildOnStartup">false</str>
<str name="buildOnCommit">false</str>
<str name="suggestAnalyzerFieldType">text_spell_en</str>
<str name="indexPath">${solr.core.dataDir}/suggesttest</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="spellcheck">true</str>
<str name="spellcheck.dictionary">en</str>
<str name="spellcheck.onlyMorePopular">true</str>
<str name="spellcheck.count">5</str>
<str name="spellcheck.collate">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
当我使用spellcheck.dictionary=categorydic
,spellcheck.cfq=harddiskcategory
,spellcheck.q=mytest
来访问此URL时,它不会过滤结果。我得到了 mytest
有任何线索吗?
修改:
Solr版本:5.3.0
Hybris Vesion:6.0
答案 0 :(得分:-1)
您必须查看impex文件的Solr配置。 solr.impex 之类的东西。在那里,您可以配置solr应该如何操作。我认为您还可以配置自动提示功能。