0
votes

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. 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

  <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>
2

2 Answers

1
votes

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.

1
votes

Quoting a Lucidworks guide :

"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."

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."

Hope this helps !