简体   繁体   English

Solr建议程序无法实时使用

[英]Solr suggester not available in near real time

I am having some trouble in showing results in near real time through the SOLR suggester.Although , if I try to use the search handler it is working properly for near real time search. 我在通过SOLR建议程序以近乎实时的方式显示结果时遇到了一些麻烦。尽管如此,如果我尝试使用搜索处理程序,则可以在近乎实时的搜索中正常工作。 If I add a document , I am able to retrieve that document in near rel time through the search handler but the same record is available in the suggester only after I reload the core.Why is this happening? 如果添加文档,则可以通过搜索处理程序在几乎相关的时间内检索该文档,但是只有在重新加载核心后,建议程序中才能提供相同的记录。为什么会这样? Here is my entry for suggester in solr-config.xml 这是我在solr-config.xml中给建议者的条目

  <searchComponent name="suggest" class="solr.SuggestComponent">
     <lst name="suggester">
      <str name="name">mySuggester</str>
      <str name="lookupImpl">FuzzyLookupFactory</str>      <!-- org.apache.solr.spelling.suggest.fst -->
      <str name="dictionaryImpl">DocumentDictionaryFactory</str>     <!-- org.apache.solr.spelling.suggest.HighFrequencyDictionaryFactory -->
      <str name="field">email</str>
      <str name="weightField">popularity</str>
      <str name="suggestAnalyzerFieldType">string</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>

Here is my entry of autocommit and soft commit(using the default value) 这是我的自动提交和软提交条目(使用默认值)

<autoCommit> 
       <maxTime>${solr.autoCommit.maxTime:15000}</maxTime> 
       <openSearcher>false</openSearcher> 
     </autoCommit>

<autoSoftCommit> 
       <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime> 
     </autoSoftCommit>

The reason that I was not able to fetch the results for suggester on near real time was that I missed this property 我无法实时获取建议者的结果的原因是我错过了此属性

<str name="buildOnCommit">true</str>

Hope this helps someone else. 希望这对其他人有帮助。

Quoting a Lucidworks guide : 引用Lucidworks指南:

"In particular, any version that uses a “DocumentDictionaryFactory” reads the raw data from the field's stored data when building the suggester! That means that if you've added 1M docs to your index and start a build, each and every document must: Be read from disk Be decompressed Be incorporated into the suggester's data structures. A consequence of this is that the field specified in the configs must have stored=”true” set in your schema. As you can imagine, this can take a while and is not to be done lightly. “A while” is almost 10 minutes on an 11M doc Wikipedia dump on a Mac Pro." “特别是,任何使用“ DocumentDictionaryFactory”的版本在构建建议程序时都会从字段的存储数据中读取原始数据!这意味着,如果您已将1M文档添加到索引并开始构建,则每个文档都必须:从磁盘中读取被解压缩并包含在建议者的数据结构中,其结果是配置中指定的字段必须在架构中设置了storage =“ true”。可以想象,这可能需要一段时间,并且在Mac Pro上的1100万文档Wikipedia转储中,“一段时间”将近10分钟。”

Knowing that : "The “buildOnStartup” parameter should be set to “false”. Really. This can lead to very long startup times, many minutes on very large indexes. Do you really want to re-read, decompress and and add the field from every document to the suggester every time you start Solr! Likely not, but you can if you want to. The “buildOnCommit” parameter should be set to “false”. Really. Do you really want to re-read, decompress and and add the field from every document to the suggester every time you commit! Likely not, but you can if you want to." 知道:““ buildOnStartup”参数应设置为“ false”。确实。这会导致很长的启动时间,在非常大的索引上会花费很多分钟。您是否真的要重新读取,解压缩和添加字段每次启动Solr时,从每个文档到建议程序都可能!可能不是,但是您可以这样做。“ buildOnCommit”参数应该设置为“ false”。确实。您真的要重新读取,解压缩和每次提交时,将每个文档中的字段添加到建议者中!可能不会,但是如果您愿意,可以。”

Hope this helps ! 希望这可以帮助 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM