Reputation: 77
I am using Suggest component in solr 6.5 version. I have configured BlendidInfixLookupFactory to sort suggestions based on the search keyword.
Below is my current configuration:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">mySuggester</str>
<str name="lookupImpl">BlendedInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">title</str>
<str name="suggestAnalyzerFieldType">text_general</str>
<str name="blenderType">position_linear</str>
<str name="numFactor">20</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
But it is not sorting based on the position of keyword and it is returning in random order and not sure what order is being followed. As per solr documentation, it should sort based on the position, but it is not working in that order.
For Example: My search keyword is blue
My Expected results: blue, blue whale, blue water, sky blue, there is a blue toy
Actual results: sky blue, blue whale, there is a blue toy, blue water, blue
Can someone please let me know if it is possible to sort in this way?
Upvotes: 0
Views: 744
Reputation: 36
As per your configuration, you are not using any weight for these suggestions so that value is always 0. So for all suggestions position_linear will be same as the logic to calculate the same is position_linear: weightFieldValue*(1 - 0.10*position).
You can add one field which can have constant value for all suggestions so when you try to do position linear it will get increased by position as per terms
I hope this helps
Upvotes: 2