Workaround needed to sort on Multivalued fields indexed in SOLR

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Workaround needed to sort on Multivalued fields indexed in SOLR

Anupam Bhattacharya
I have indexed many documents which has a field for authors which is
multivalued.

<field name="authors" type="string" indexed="true" stored="true" multiValued
="true"/>

How can I sort & order by on this kind of multivalued field ? Pls. suggest
any workaround ?

Thanks
Anupam
Reply | Threaded
Open this post in threaded view
|

RE: Workaround needed to sort on Multivalued fields indexed in SOLR

Robert Sandiford
How are you hoping that Sort will work on a multivalued field?  Normally, trying to do this makes no sense.

For example, if you have two authors for a document:
        Smith, John
        Jones, Joe

Then would you expect the document to sort under 'S' for Smith, or 'J' for Jones?  There's probably not a specific rule to choose one or the other, at least not in a generic sense.

If you wanted (for example) to be able to sort by the first author, then you could index just the first author in a separate, non-multivalued field, purely for the sort (while still having all the authors in your multivalued field)

Bob Sandiford | Lead Software Engineer | SirsiDynix
P: 800.288.8020 X6943 | [hidden email]
www.sirsidynix.com
 
Join the conversation: Like us on Facebook! Follow us on Twitter!


-----Original Message-----
From: Anupam Bhattacharya [mailto:[hidden email]]
Sent: Thursday, May 17, 2012 1:13 AM
To: [hidden email]
Subject: Workaround needed to sort on Multivalued fields indexed in SOLR

I have indexed many documents which has a field for authors which is multivalued.

<field name="authors" type="string" indexed="true" stored="true" multiValued ="true"/>

How can I sort & order by on this kind of multivalued field ? Pls. suggest any workaround ?

Thanks
Anupam