Set up an individual order for faces coming from Solr

I use Solr to create smooth navigation for an e-commerce site. However, I need to define a custom order for the facets, but I have not found how to do this in Solr.

Any ideas how to do this? I use Solr Net and the latest version of Solr.

Here is an example of what I need to do.

Current facets

operating system

  • Android (32)
  • Blackberry OS (8)
  • Windows (6)
  • Apple iOS (6)
  • Bada (5)
  • Owner (2)

Price

  • 10001 - 20,000 (42)
  • 20001 - 25000 (12)
  • 500 - 5000 (11)
  • 5001 - 10,000 (8)

Please note that this is just an example. And there are many other aspects. I want to display β€œPrice” as the first facet, so you need to order this facet field, as well as facet options like this.

Price

  • 500 - 5000 (11)
  • 5001 - 10,000 (8)
  • 10001 - 20,000 (42)
  • 20001 - 25000 (12)

operating system

  • Android (32)
  • Apple iOS (6)
  • Bada (5)
  • Blackberry OS (8)
  • Owner (2)
  • Windows (6)

So here is how I need to order it:

  • Set the Facet field manually in any way so that they appear in a specific order
  • The procedure in accordance with a specific order. For the OS, I ordered it in alphabetical order. Or maybe for those faces that do not have a specific order, maybe the default order depending on the number of samples in the result?

Advise Pls.

+4
source share
2 answers

You can use facet sorting for each field to arrange different faces accordingly.

eg. f.<field_name>.facet.sort=count|index

Solr provides only two options, Sort and Sort Indexes. Everything else must be implemented using Custome solutions or workarounds.

+6
source

You can sort by predefined criteria only.

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

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

0
source

Source: https://habr.com/ru/post/1500171/


All Articles