Chandan
Chandan

Reputation: 23

Solr Suggester taking too long to provide response

I am using Solr Suggester to provide suggestion in the search page of our application. But every suggestion request to Solr is taking too long to send response. I have tried with multiple lookup Impl such as AnalyzingLookupFactory, AnalyzingInfixLookupFactory, FuzzyLookupFactory etc.

Below is my configuration:

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">mySuggester</str>
        <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">spell_suggest</str>
        <str name="weightField">spell_suggest</str>
        <str name="suggestAnalyzerFieldType">text_general</str>
        <str name="buildOnStartup">false</str>
    </lst>
    <lst name="suggester">
        <str name="name">altSuggester</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="lookupImpl">FuzzyLookupFactory</str>
        <str name="field">spell_suggest</str>
        <str name="weightField">spell_suggest</str>
        <str name="suggestAnalyzerFieldType">text_general</str>
 </lst>
</searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
    <!--<str name="suggest.dictionary">mySuggester</str> -->
    <str name="suggest.dictionary">altSuggester</str>
    <str name="suggest">true</str>
    <str name="suggest.count">6</str>
    <str name="spellcheck">true</str>
</lst>
<arr name="components">
    <str>suggest</str>
</arr>
</requestHandler>

The response, with just 42000 indexed documents, is taking close to 5 to 7 seconds to provide response. This is impacting the functionality badly in the application

Following is my request: http://<myIP>:8983/solr/mycollection/suggest?df=spell_suggest&suggest=true&suggest.build=true&q=Vendor

Please suggest if I need to provide few more configurations or need to modify existing configurations to improve performance.

Thanks!

Upvotes: 1

Views: 570

Answers (1)

MatsLindh
MatsLindh

Reputation: 52912

When you're issuing suggest.build each time, you're effectively asking for the suggestion index to be rebuilt from scratch each time you're querying the suggester.

It should only be rebuilt after changes if necessary (depending on which dictionaryImpl you're using).

Upvotes: 2

Related Questions