Sorting by date with SOLR

Just went through a few hours of pounding my head.  I couldn’t, for the life of me, get SOLR to return results sorted by a new date field added to our schema.  My query was simply:

pr_score:[3 TO *] sort pr_lastUpdated desc

No matter what, the results came back sorted by ANYWHICHFRICKINWAY.

Scouring the mailing lists and google search results yielded exactly squat.  Then I found it.  By pure chance I was looking at a developerworks article on IBM and in a table at the bottom the showed this crazy syntax:

q=myField:Java AND otherField:developerWorks; date asc

What the shit is that? A semicolon instead of “sort”. Okay… SHIT! It works!

So there you are. Don’t follow the SOLR Wiki on this. It’s very ambiguous on the correct syntax. And for you OpenSourceTards out there, no I will not go update the Wiki myself. Do a good job the first time.

mike: Mike is an opinionated computer programmer living in Michigan with his wife and two kids.

Discussion

No comments yet, be the first.

Leave a Comment