6

So I want to sort my Solr response by the following fields:

  • published_year (desc)
  • series_number (asc)
  • status_color

Problem is that status_color must be sorted by the following values (e.i. not alphabetically):

  • "Green"
  • "Yellow"
  • "Red"

This field may only contain one of these values.

I'm hoping theres a way of doing this in the Solr query instead of massaging the result in code. With a result of hundreds of thounsands of documents it's not really an option.

Any help is appreciated.

Fredrik
  • 1,741
  • 4
  • 24
  • 40

2 Answers2

3

I think the answer for this question will be valid for you too:

Is it possible in solr to specify an ordering of documents

Community
  • 1
  • 1
Yann
  • 1,019
  • 1
  • 8
  • 18
3

I believe Solr has Enum types, though I have never seen them used in a while. But they would be a perfect match, so worth a try.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27