Hi,
I'm using Solr 7.1.0 (but I guess all what I'm going to describe is the
same in the previous versions) and I have to implement a simple product
name suggester.
I started focusing on the BlendedInfixLookup which could fit my needs, but
I have some doubts, even after looking at the code, about how it works. I
have several questions:
*1) org.apache.lucene.search.suggest.Lookup*
The formula in the BlendedInfixSuggester documentation says "final weight =
1 - (0.10*position)" so it would suggest to me a float or a double
datatype. Instead, the "value" instance member of the Lookup class, which
should hold the computed weight, it's a long.
I realised that because, in a scenario where the weight field in my schema
always returns 1, the final computed weight is always 0 or 1, therefore
loosing the precision when the actual result of the formula above is
between 0 and 1 (excluded).
2) *Position role within the **BlendedInfixSuggester*
If I write more than one term in the query, let's say
"Mini Bar Fridge"
I would expect in the results something like (note that
allTermsRequired=true and the schema weight field always returns 1000)
- *Mini Bar Fridge* something
- *Mini Bar Fridge* something else
- *Mini Bar* something *Fridge*
- *Mini Bar* something else *Fridge*
- *Mini* something *Bar Fridge*
...
Instead I see this:
- *Mini Bar* something *Fridge*
- *Mini Bar* something else *Fridge*
- *Mini Bar Fridge* something
- *Mini Bar Fridge* something else
- *Mini* something *Bar Fridge*
...
After having a look at the suggester code (BlendedInfixSuggester.
createCoefficient), I see that the component takes in account only one
position, which is the lowest position (among the three matching terms)
within the term vector ("mini" in the example above) so all the suggestions
above have the same weight
score = weight * (1 - 0.10 * position) = 1000 * (1 - 0.10 * 0) = 1000
Is that the expected behaviour?
Many thanks in advance
Andrea