使用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>

最佳答案

我也遇到了同样的问题:一个客户要求我在装有Solr 5.5.0、1个核心/节点,500k +文档的Win2008计算机上激活建议程序模块。

我认为StackOverflowError是由于某些 FuzzyLookupFactory 实现而导致的,当它必须从头开始构建大型Lookup Data Structure时,该实现无法正常工作。

我无法使Fuzzy建议程序与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>

更多引用here和文档here中。

请注意:
  • buildOnCommit参数设置为false以提高性能
  • .com的anat_rli建议类型实现一个分析器,该分析器仅考虑字母数字/数字字符的小写字母,尽管结果在原始情况下为
  • 即使将buildOnStartup参数设置为true,我也注意到它似乎不起作用。作为重新启动后的第一个操作,我必须手动执行带有“suggest.build = true”参数的查询,以使其真正构建。例如
    http://localhost:82/solr/mycore/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=docum在我的配置中,这通常需要几分钟才能完成。在不进行强制构建的情况下进行后续查询仅需几毫秒。
  • 关于java - Solr的建议者抛出StackOverflow错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33749956/

    10-13 05:00