Solr returns incorrect results after sorting
Hi, I am using group.sort to internally sort the values first based on store(using function),then stock and finally distance and sort the output results based on price, but solr does not return the correct results after sorting. Below is the sample query: q=*:*&start=0&rows=200&sort=pricecommon_double desc&d=321&spatial=true&sfield=store_location&fl=geodist(),*&pt=37.1037311,-76.5104751& group.ngroups=true&group.limit=1&group.facet=true&group.field=code_string&group=true&group.sort=max(if(exists(query({!v='storeName_string:212'})),2,0),if(exists(query({!v='storeName_string:203'})),1,0)) desc,inStock_boolean desc&geodist() asc I am expecting all the docs to be sorted by price from high to low after grouping, but i see the records not matching the order, Do you see any issues with the query or having functions in group.sort is not supported in solr? Regards, Raj -- View this message in context: http://lucene.472066.n3.nabble.com/Solr-returns-incorrect-results-after-sorting-tp4193266.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Solr returns incorrect results after sorting
Thanks David, that was a typo. Do you see any other issues? While solr does the grouping and if more than one document which are matched with given group.sort condition(numfound=2), then that particular document is not sorted correctly, when sorted by price.(sort=price) is applied across all the groups. Example: Below is the sample result. 10001 729.97 10001 Product1 203 198.70324062133778 10002 279.99 10002 Product2 212 0.0 10003 479.99 10003 Product3 203 198.70324062133778 I expect product 10002, to be sorted and shown after 1003, but it is not sorted correctly. -- View this message in context: http://lucene.472066.n3.nabble.com/Solr-returns-incorrect-results-after-sorting-tp4193266p4193457.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Solr returns incorrect results after sorting
Hi Jim, Yes, you are right.. that document is having price 499.99, But i want to consider the first record in the group as part of the main sort. Even though if i add price asc in the group.sort, but still the main sort does not consider that. group.sort=max(if(exists(query({!v='storeName_string:212'})),2,0),if(exists(query({!v='storeName_string:203'})),1,0)) desc,inStock_boolean desc&geodist() asc,pricecommon_double asc&sort=pricecommon_double desc Is there any other workaround so that sort is always based on the first record which is pulled up in each group? Regards, Raj -- View this message in context: http://lucene.472066.n3.nabble.com/Solr-returns-incorrect-results-after-sorting-tp4193266p4193658.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Solr returns incorrect results after sorting
*if the number of documents in one group is more than one then you cannot ensure that this document reflects the main sort Is there a way the top record which is coming up in the group is considered for sorting? We require to show the record from 212(even though price is low) in both the cases of high to low or low to high..and still the main sorting should work? -- View this message in context: http://lucene.472066.n3.nabble.com/Solr-returns-incorrect-results-after-sorting-tp4193266p4194008.html Sent from the Solr - User mailing list archive at Nabble.com.