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.

About the Author:

Learned something? Need help on your dev project? Well, I'm available for hire on project work:

  • Front End Development (jQuery, ExtJS, Backbone)
  • iOS Development
  • Server Side Development (Java Stack or Rails Stack)
  • System Architecture

Contact me:

Discussion

  1. Devin Foley says:

    This also works:

    q=myField:Java AND otherField:developerWorks&sort=date asc

Leave a Comment