我的建议者会议:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">titleSuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="field">name</str>
<str name="suggestAnalyzerFieldType">text_pt</str>
<str name="payloadField">type</str>
<str name="weightField">weightField</str>
<str name="buildOnCommit">false</str>
<str name="buildOnStartup">false</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="indexPath">/home/dev/suggestions</str>
</lst>
<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">titleSuggester</str>
<str name="suggest.onlyMorePopular">true</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
这是工作!但是,我需要每小时建立我的字典,而这个建立需要2分钟。每小时我运行:
localhost:8983/solr/AutoComplete/suggest?suggest.q=term&suggest.build=true
在这段时间里,我需要得到结果,但当我运行一个查询为:
localhost:8983/solr/AutoComplete/suggest?suggest.q=term
我得到如下返回(因为生成正在运行):
<response>
<lst name="responseHeader">
<int name="status">500</int>
<int name="QTime">5</int>
</lst>
<lst name="error">
<str name="msg">suggester was not built</str>
如何在运行构建时获得结果?
1条答案
按热度按时间0ve6wy6x1#
这个问题是相当老,但我有同样的问题(我的重建可能会运行一个小时),我来到这个解决方案:
配置两个组件,例如,使用不同的indexPath值配置sugest_A和sugest_B。配置两个请求处理程序,例如,sugest和sugest_Rebuild。将sugest_A分配给sugest,将sugest_B分配给sugest_Rebuild。在sugest_Rebuild处理程序上执行重建。完成重建后,通过配置API(update-requesthhandler)切换两个组件的组件分配。
这种解决方案的缺点是需要双倍的磁盘空间。