I just want to interject to say one thing: You *can* sort on multi-valued fields as-of recent Solr 5 releases. it's done using the "field" function query with either a "min" or "max" 2nd argument: https://cwiki.apache.org/confluence/display/solr/Function+Queries Of course it'd be nicer to simply sort asc/desc on the field like normally and not use this special syntax but AFAIK that convenience hasn't been added yet.
~ David On Mon, Feb 15, 2016 at 10:26 AM Binoy Dalal <binoydala...@gmail.com> wrote: > I'm sorry, missed that part. It's true, you cannot sort on multivalued > fields. The workaround will be pretty complex; you'll either have to find > the max or min value of the fields at index time and store those in > separate fields and use those to sort, or somehow come up with some > function that can convert the values from your multivalued field into a > single value (something like sum(field)) but it surely won't be trivial. > > Instead you should do what Emir's saying. > Boost your fields at index or query time based on how you want to sort your > documents. > So in your case, give the highest boost to topic_title then a little lower > to subtopic_title and so on. This should return your documents in the > correct order. > You will have to play around with the boost values a little to get them > right, though. > > Alternatively, you could boost on the multivalued fields and then sort > based on your single valued fields. > > Either ways, you'll have to experiment and see what works best for you. > > On Mon, Feb 15, 2016 at 8:21 PM Nitin.K <nitin.kanu...@adi-mps.com> wrote: > > > Thanks Binoy.. > > > > Actually it is throwing following error: > > > > can not sort on multivalued field: index_term > > > > > > > > -- > > View this message in context: > > http://lucene.472066.n3.nabble.com/SOLR-ranking-tp4257367p4257378.html > > Sent from the Solr - User mailing list archive at Nabble.com. > > > -- > Regards, > Binoy Dalal > -- Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker LinkedIn: http://linkedin.com/in/davidwsmiley | Book: http://www.solrenterprisesearchserver.com