Fredrik
Fredrik

Reputation: 1821

Sort by multiple fields in specific order in Solr

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

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

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.

Upvotes: 6

Views: 5642

Answers (2)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

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.

Upvotes: 3

Yann
Yann

Reputation: 1019

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

Is it possible in solr to specify an ordering of documents

Upvotes: 3

Related Questions