You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Lasitha Wattaladeniya <wa...@gmail.com> on 2016/07/29 08:55:48 UTC
How to get suggestions with numbers?
Hi devs,
Past couple of days I was trying to get solr suggestions work with my
applications. The requirement is as follows,
I have some codes eg :abcdef20000. I should be able to type "2000" and get
suggestions as abcdef20000.
I index the field containing the code to a ngram field (standard
analysers, nothing fancy). But it does not show the required suggestion.
I think since I'm using spellchecker component with suggester, when I
enter numbers the solr thinks I don't need suggestions.
Can anybody help me to solve this problem?
Regards,
Lasitha
Re: How to get suggestions with numbers?
Posted by Alessandro Benedetti <ab...@apache.org>.
Hi Lasitha,
do you need only to suggest terms ?
In that case I would *suggest* you to use the suggester component.
Specifically your use case is infix suggestion.
This can be easily achieved using an AnalyzingInfixSuggester :
<lst name="suggester">
<str name="name">AnalyzingInfixSuggester</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">title</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">text_en</str>
</lst>
In your case just use a proper analyser, which I guess will use the word
delimiter token filter [1] .
It should do it ( in particular the splitOnNumerics feature) .
Feel free to read my blog for additional details [2]
Cheers
[1] Word Delimiter Token Filter
<https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-WordDelimiterFilter>
[2] Ad Maiora - Solr Autocomplete
<http://alexbenedetti.blogspot.co.uk/2015/07/solr-you-complete-me.html>
[3] Lucidwork Erick blog
<https://lucidworks.com/blog/2015/03/04/solr-suggester/>
On Fri, Jul 29, 2016 at 9:55 AM, Lasitha Wattaladeniya <wa...@gmail.com>
wrote:
> Hi devs,
>
> Past couple of days I was trying to get solr suggestions work with my
> applications. The requirement is as follows,
>
> I have some codes eg :abcdef20000. I should be able to type "2000" and get
> suggestions as abcdef20000.
>
> I index the field containing the code to a ngram field (standard
> analysers, nothing fancy). But it does not show the required suggestion.
> I think since I'm using spellchecker component with suggester, when I
> enter numbers the solr thinks I don't need suggestions.
>
> Can anybody help me to solve this problem?
>
> Regards,
> Lasitha
>
--
--------------------------
Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti
"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"
William Blake - Songs of Experience -1794 England