Ammar Ammar - 3 months ago 17
Java Question

Solr Suggester - case insensitive

I am trying to work on an autocomplete feature on Solr and the way I found how to do it, is to use Solr Suggester. However, it does not work as expected. If someone invokes

while the index has a field that starts with
it will not come out. I have request with
(with an upper case).

Is there a way to make Solr Suggester case-insensitive?

Here are my configurations:

<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">autocomp</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">string</str>

Here are relevent parts of the schema:

<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>

<field name="autocomp" type="textSuggest" indexed="true" stored="true" multiValued="true"/>

<copyField source="title" dest="autocomp"/>



I found out that the issue is with this part of searchComponent configurations:

<str name="suggestAnalyzerFieldType">string</str>

You have to put the field you are using for analyzing the text. In my case it was:

<str name="suggestAnalyzerFieldType">text_general</str>