gpt4 book ai didi

java - Solr suggester 抛出 stackoverflow 错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:24:58 26 4
gpt4 key购买 nike

使用 solr suggester 时显示以下错误。有没有人遇到过类似的错误。是由于查找工厂限制导致的错误。

错误

{"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)

配置架构.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 机器上激活 suggester 模块。

我想 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>


更多引用here在文档中here .


请注意:

  1. buildOnCommit 参数设置为 false 以提高性能
  2. suggestTypeLc 实现了一个只考虑字母数字/数字字符小写的分析器,尽管结果是原始大小写
  3. 即使 buildOnStartup 参数设置为 true,我也注意到它似乎不起作用。作为重启后的第一个操作,我必须手动执行带有“suggest.build=true”参数的查询以使其真正构建。例如

    http://localhost:82/so​​lr/mycore/suggest?suggest=true&suggest.build=true&suggest.dictionary=mySuggester&wt=json&suggest.q=docum

    在我的配置中,这通常需要几分钟才能完成。在没有强制构建的情况下进行查询仅需几毫秒。

关于java - Solr suggester 抛出 stackoverflow 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33749956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com