Reputation: 247
I'm trying to search in solr and the results have to be sorted first on date and then on name field. I'm able to get the expected result because the date is in this format: 2012-09-07T13:31:35Z
.
The query goes like this:
sort=date+desc,name+desc
I don't want the sorting to be done on time also.
Upvotes: 1
Views: 104
Reputation: 53603
Another option would also to store only the date part as a numeric representation (i.e. time stamp, seconds from some date in the past until the document's date at 12am).
If u follow common standards on timestamps, should be fairly easy to maintain, query and transform from timestamp to date and vice versa.
Upvotes: 0
Reputation: 113
You can use function on date e.g. in your case
sort=floor(div(ms(date),86400000))+desc,name+desc
Do note that this requires dynamicField for wildcard not set to be ignored i.e. following line should not be present in schema.xml , and if it is then you will need to comment it out or use some numeric type before you can sort as above
<dynamicField name="*" type="ignored" multiValued="true" />
Upvotes: 1