Search code examples
solrsolrnet

Solr facet on a multi value field


Is it possible to facet on a multi value field using SolrNet? I have a date field but it needs to be multivalued as it's for binaries. When I try to run my application and apply a sort I get an error:

Apache Tomcat/7.0.29 - Error report

525D76;}--> HTTP Status 400 - can not sort on multivalued field: date

noshade=\"noshade\">

type Status report

message can not sort on multivalued field: date

description The request sent by the client was syntactically incorrect (can not sort on multivalued field: date).

Apache Tomcat/7.0.29

I've had a read online and it seems like most of the answers suggest that this isn't possible - is this true?


Solution

  • Which of the multiple of values would you like to sort multiValued field on? Solr can't decide for you.

    The usual answer is to create a second field just for sort, it does not need to be stored. Then, you use Update Request Processor to populate that second field from the first and you only keep one value which will be used for sort.

    The relevant URPs - in this order - are:

    1. CloneField
    2. DefaultValue - in case you have optional fields and you want a sane default
    3. One of the FieldValueSubset children (Min, Max, First, Last)