title: Adding Solr sort criteria to named query in Spring Data
body: <p>I am trying to add a <strong>sort</strong> criteria to a Spring data Solr search. </p>
  
  <p>I have seen methods for sorting search results (List&lt;> .. after the data has been received from Solr) but not for specifying the sort order to Solr in the query.
  The Solr query should look like....</p>
  
  <pre><code>http://localhost:8088/solr/books/select?fl=fullrecord%2C%20url&amp;q=mod_date%3A%5B2012-04-17T11%3A38%3A15Z%20TO%20NOW%5D&amp;sort=mod_date%20asc
  </code></pre>
  
  <p>I need to do this <strong>in Solr</strong> because the request is paged (there are potentially hundreds of thousands of results) and so only a limited number of results (one page) are returned for each query.
  How can I add the "&amp;sort=mod_date asc" solr query string?</p>
  
  <pre><code>// Catalog.findByDateChanged=mod_date:[?0 TO ?1]
  
  public interface CatalogRepository extends SolrCrudRepository&lt;CatalogDoc, String&gt; {
      @Query(name = "Catalog.findByDateChanged", fields = { "fullrecord", "url" })
      public Page&lt;CatalogDoc&gt; findByDateChanged(String fromDate, String toDate, Pageable pageable);
  
  }
  </code></pre>