On 1/25/2015 4:13 PM, tedsolr wrote: > I'll bet some super user has figured this out. How can I perform a sort on a > single computed field? I have a QParserPlugin that is collapsing docs based > on data from multiple fields. I am summing the values from one numerical > field 'X'. I was going to use a DocTransformer to inject that summed value > into the search results as a new field. But I have now realized that I have > to be able to sort on this summed field. > > Without retrieving all results (which could be 1M+) in my app and sorting > manually, is there any way to sort on my computed field within Solr? > (using Solr 4.9)
Sorting by a function query: http://wiki.apache.org/solr/FunctionQuery#Sort_By_Function https://cwiki.apache.org/confluence/display/solr/Function+Queries#FunctionQueries-SortByFunction The second URL also shows how to put the results of a function into the search results as a pseudo-field. You do mention that you are talking about summing the values from one field ... if that's not being done with a function query, then this probably does not apply, and I don't know what you'll need. Thanks, Shawn