Krunal
Krunal

Reputation: 3277

Set Custom Order for Facets coming from Solr

I'm using Solr for offering faceted navigation for e-commerce site. However I need to define the custom order for facets, but I didn't find how to do that in Solr.

Any idea how to do this? I'm using Solr Net and latest version of Solr.

Here is an example what I need to do.

Current Facets

Operating System

Price

Note that it is just an example. And have many other facets. I want to display Price as the first facet, so need to order this facet field as well as facet options like this.

Price

Operating System

So here is how I need to order it:

  1. Order Facet Field manually by some way so they are displayed on specific order
  2. Order Facets as per the defined order. For OS, I ordered it alphabetically. Or may be for those facets which doesn't have order defined can be order as default based on number of count in result?

Pls advise.

Upvotes: 7

Views: 15645

Answers (2)

Jayendra
Jayendra

Reputation: 52809

You can use facet sort per field to order the different facets respectively.

e.g. f.<field_name>.facet.sort=count|index

Solr only provided two options Count and Index sort. Anything else needs to implemented through custom solutions or workarounds.

Upvotes: 9

Maurizio In denmark
Maurizio In denmark

Reputation: 4284

You can only sort by predefined criteria.

facet.sort is what you use and it can only be: - count - sort the constraints by count (highest count first) - index - to return the constraints sorted in their index order (lexicographic by indexed term). For terms in the ascii range, this will be alphabetically sorted.

Have a look at this: http://wiki.apache.org/solr/SimpleFacetParameters#facet.sort

Upvotes: 0

Related Questions