Suggester case (in)sensitive

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggester case (in)sensitive

Moritz Schmidt-2
Hello everyone.

I’m trying to build autocomplete functionality.
My setup works but has one problem:
When using HighFrequencyDictionaryFactory the Suggestion-Results I get are all lowercase as defined in my schema.xml:

<fieldType name="suggestion_text" class="solr.TextField" positionIncrementGap="100" multiValued="true" stored="true">
  <analyzer>
    <tokenizer class="solr.KeywordTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

Without the LowerCaseFilterFactory I get my results as I want but the search is case sensitive.

When using DocumentDictionaryFactory I get my suggestions in unaltered form but I get a lot of duplicates as I’m using amongst others a field for keywords for suggestions and DocumentDictionaryFactory saves them per Document(?)


Is this intended behaviour for HighFrequencyDictionaryFactory?
In case it is, how would you solve that? Remove the LowerCaseFilterFactory and write a custom SuggestComponent that searches the query lowercased and with the first letter capitalized?

Here’s the solrconfig.xml excerpt for reference:
<lst name="suggester">
  <str name="name">texts</str>
  <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
  <str name="dictionaryImpl">HighFrequencyDictionaryFactory</str>
  <!-- <str name="dictionaryImpl">DocumentDictionaryFactory</str> -->
  <str name="field">suggestion</str>
  <str name="suggestAnalyzerFieldType">suggestion_text</str>
  <str name="buildOnStartup">false</str>
  <str name="buildOnCommit">true</str>
  <str name="exactMatchFirst">true</str>
  <str name="highlight">false</str>
  <float name="threshold">0.0</float>
</lst>

Thanks for your help,
Moe
Reply | Threaded
Open this post in threaded view
|

Re: Suggester case (in)sensitive

Moritz Schmidt-2
Does anyone have an idea?

Thanks and best regards,
Moe

> Am 20.03.2019 um 15:19 schrieb Moritz Schmidt <[hidden email]>:
>
> Hello everyone.
>
> I’m trying to build autocomplete functionality.
> My setup works but has one problem:
> When using HighFrequencyDictionaryFactory the Suggestion-Results I get are all lowercase as defined in my schema.xml:
>
> <fieldType name="suggestion_text" class="solr.TextField" positionIncrementGap="100" multiValued="true" stored="true">
>  <analyzer>
>    <tokenizer class="solr.KeywordTokenizerFactory"/>
>    <filter class="solr.LowerCaseFilterFactory"/>
>  </analyzer>
> </fieldType>
>
> Without the LowerCaseFilterFactory I get my results as I want but the search is case sensitive.
>
> When using DocumentDictionaryFactory I get my suggestions in unaltered form but I get a lot of duplicates as I’m using amongst others a field for keywords for suggestions and DocumentDictionaryFactory saves them per Document(?)
>
>
> Is this intended behaviour for HighFrequencyDictionaryFactory?
> In case it is, how would you solve that? Remove the LowerCaseFilterFactory and write a custom SuggestComponent that searches the query lowercased and with the first letter capitalized?
>
> Here’s the solrconfig.xml excerpt for reference:
> <lst name="suggester">
>  <str name="name">texts</str>
>  <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
>  <str name="dictionaryImpl">HighFrequencyDictionaryFactory</str>
>  <!-- <str name="dictionaryImpl">DocumentDictionaryFactory</str> -->
>  <str name="field">suggestion</str>
>  <str name="suggestAnalyzerFieldType">suggestion_text</str>
>  <str name="buildOnStartup">false</str>
>  <str name="buildOnCommit">true</str>
>  <str name="exactMatchFirst">true</str>
>  <str name="highlight">false</str>
>  <float name="threshold">0.0</float>
> </lst>
>
> Thanks for your help,
> Moe