我尝试在 SOLR 建议器中使用 contextField(运行 SOLR 7)
但是当我尝试构建建议器时,出现错误
原因:java.lang.IllegalArgumentException:文档在 field="exacttext" 中包含至少一个巨大的术语(其 UTF8 编码长于最大长度 32766),所有这些都被跳过。请更正分析器以不产生此类术语。第一个巨大术语的前缀是...
exacttext
不过,在我的整个设置中没有命名字段。
当我使用 FreeTextLookupFactory 时,这不会发生,但是我当然不能使用 contextField。
我尝试添加
<filter class="solr.LengthFilterFactory" min="2" max="32700"/>
也
<filter class="solr.TruncateTokenFilterFactory" prefixLength="100"/>
到托管模式,但这也不起作用。
这是我尝试使用的 searchComponent:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">suggestText</str>
<str name="highlight">false</str>
<str name="storeDir">mySuggester</str>
<str name="separator"> </str>
<str name="suggestAnalyzerFieldType">suggestField</str>
<str name="buildOnCommit">false</str>
<str name="buildOnStartup">false</str>
<str name="contextField">context_field</str>
</lst>
</searchComponent>
这是托管模式中建议者的配置:
<fieldType name="suggestField" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" catenateWords="1" generateNumberParts="0" splitOnCaseChange="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.LengthFilterFactory" min="2" max="32700"/>
<filter class="solr.TruncateTokenFilterFactory" prefixLength="100"/>
</analyzer>
</fieldType>
-- 字段部分 ---
<field name="ID" type="text_general" indexed="true" stored="true"/>
<field name="TITLE" type="tokenized" indexed="true" stored="true"/>
<field name="ANRISS" type="tokenized" indexed="true" stored="true"/>
<field name="LEAD" type="tokenized" indexed="true" stored="true"/>
<field name="BODY" type="tokenized" indexed="true" stored="true"/>
<field name="PDFDOC" type="text_general" indexed="true" stored="true"/>
<field name="MAGID" type="text_general" indexed="true" stored="true"/>
<field name="MAGNAME" type="text_general" indexed="true" stored="true"/>
<field name="MAGISSUE" type="text_general" indexed="true" stored="true"/>
<field name="ARTICLETYPE" type="text_general" indexed="true" stored="true"/>
<field name="IS_FREE" type="text_general" indexed="true" stored="true" />
<field name="THEMA" type="text_general" indexed="true" stored="true"/>
<field name="CREATIONDATE" type="pdate" indexed="true" stored="true"/>
<field name="LASTUPDATE" type="pdate" indexed="true" stored="true"/>
<copyField source="TITLE" dest="fulltext" />
<copyField source="ANRISS" dest="fulltext" />
<copyField source="LEAD" dest="fulltext" />
<copyField source="BODY" dest="fulltext" />
<field name="fulltext" stored="true" type="tokenized" multiValued="true" indexed="true" />
<copyField source="TITLE" dest="suggestText" />
<copyField source="ANRISS" dest="suggestText" />
<copyField source="LEAD" dest="suggestText" />
<copyField source="BODY" dest="suggestText" />
<field name="suggestText" stored="true" type="text_general" multiValued="true" indexed="true" />
<copyField source="MAGID" dest="context_field" />
<copyField source="ARTICLETYPE" dest="context_field" />
<field name="context_field" stored="true" type="suggestField" multiValued="true" indexed="true" />