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 "Gupta, Abhinav" <ab...@ptc.com> on 2013/12/31 13:54:48 UTC
Custom sorting on facets
Hi,
I am using facets for suggestions. By default facet sort is based only on index order and count.
Now, in that I have a requirement that based on a value in solr doc ;some suggestions must be at top and then other.
Example :
<doc>
<id>doc1</id>
<name>ProductInstance<name/>
<machineId>hydraulic</machineId>
</doc>
<doc>
<id>doc2</id>
<name>ProductInstance<name/>
<machineId>other hydraulic</machineId>
</doc>
<doc>
<id>doc3</id>
<name>Product<name/>
<machineId>test hydraulic</machineId>
</doc>
<doc>
<id>doc4</id>
<name>Product<name/>
<machineId>other test hydraulic </machineId>
</doc>
In above 4 solr documents ,I will be having many more fields... In suggestions I want to create facet on machineID... But I want to sort it based on name field ..
Say if I queried for hy*.. then I should get facet from all 4 docs but sorted by name field.
PS: I can't use any other type of suggester as I need to display whole machineID text as suggestions and not a single word..
Many Thanks,
Abhinav