Sorting can be done on the "score" of the document, or on any multiValued="false" indexed="true" field provided that field is either non-tokenized (ie: has no Analyzer) or uses an Analyzer that only produces a single Term (ie: uses the KeywordTokenizer)
docs:- http://wiki.apache.org/solr/CommonQueryParameters#sort
My original schema is (You can consider the following is a GROUP-BY) :-
- products (id, unique)
- users who make some comments(multiValued)
- last_comment_date for each user (multiValued, one user can make multiple comments, but only the last comment date is captured)
If sorting on multiValued is allowed,
I can easily get list of the products commented by certain users,
then sort by last_activity_date.
However, it does not work.
The workaround I have currently is to reverse the schema to :-
- user + product (as id, unique)
- user (single value)
- last_comment_date
- products
Which mean I (sort of) manage to get list of the products commented by certain users,
order by last_comment_date,
of course it lead to duplication of products
as product will appear in each of the user's comment.
Any suggestion to simulate a group-by effect.
Between, I using solr 3.1.
Field collapsing does not apply.