使用solr建议器时会显示以下错误。有没有人遇到类似的错误。是由于查找工厂限制导致的错误。
错误
{"error":{"msg":"java.lang.StackOverflowError",
"trace":"java.lang.RuntimeException: java.lang.StackOverflowError
org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:618)
org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:477)
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:214)
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
org.eclipse.jetty.server.Server.handle(Server.java:499)
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
java.lang.Thread.run(Thread.java:745)\nCaused by: java.lang.StackOverflowError
org.apache.lucene.util.automaton.Operations.topoSortStatesRecurse(Operations.java:1311)
配置Schema.xml
<field name="description" type="text_ja"
stored="true" indexed="true" multiValued="true"/>
<field name="textSuggest" type="textSuggest"
indexed="true" stored="true" multiValued="true"/>
<copyField source="description" dest="text"/>
solrconfig.xml中
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">Suggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">textSuggest</str>
<!-- <str name="weightField">price</str> -->
<str name="suggestAnalyzerFieldType">string</str>
<str name="buildOnStartup">false</str>
<str name="buildOnCommit">false</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler"
startup="lazy" >
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
答案 0 :(得分:1)
我也有同样的问题:客户要求我在带有Solr 5.5.0,1核心/节点,500k +文档的Win2008机器上激活建议模块。
我认为StackOverflowError是由于某些 FuzzyLookupFactory 实现,当它必须从头开始构建大型查找数据结构时,它不能正常工作。 />
我无法让建议者使用 FuzzyLookupFactory ,在这种情况下,我唯一的解决方案是使用 FreeTextLookupFactory 。
我发布了我的配置文件的摘录,希望这会有所帮助:
<强> solrconfig.xml中强>
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FreeTextLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">content</str>
<str name="suggestFreeTextAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">mySuggester</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
<强> schema.xml中强>
<fieldType name="suggestTypeLc" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<charFilter class="solr.PatternReplaceCharFilterFactory" pattern="[^a-zA-Z0-9]" replacement=" " />
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
请注意:
即使 buildOnStartup 参数设置为true,我也注意到它似乎不起作用。作为重启后的第一个操作,我必须用&#34; suggest.build = true&#34;手动执行查询。使其真正构建的参数。 e.g。
http://localhost:82/solr/mycore/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=docum
在我的配置中,这通常需要几分钟才能完成。在没有强制构建的情况下进行查询只需几毫秒。
答案 1 :(得分:1)
尝试将关键字字段用作建议者的输入作为变通方法。这对我来说就17M文档索引起了作用。但是,只有在该字段的内容只是几个单词时,这才有用。在较长的文本中,这不会产生有用的建议。
<强> schema.xml中强>
<fieldType name="text_keyword_low" class="solr.TextField">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
<fields>
<field name="SUGGEST_COPY" type="text_keyword_low" indexed="true" stored="true" multiValued="true" />
</fields>
<强> solrconfig.xml中强>
<searchComponent name="sugBySugComp" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">sugBySugDictonary</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="payloadField">MEDIA_ID</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="storeDir">sugBySugDir</str>
<str name="field">SUGGEST_COPY</str>
<str name="suggestAnalyzerFieldType">suggest_field</str>
<str name="buildOnStartup">false</str>
<str name="buildOnCommit">false</str>
</lst>
</searchComponent>
<requestHandler name="/sugBySug" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
<str name="suggest.dictionary">sugBySugDictonary</str>
</lst>
<arr name="components">
<str>sugBySugComp</str>
</arr>
</requestHandler>