On 9/13/2013 6:56 PM, suren wrote: > I tried below 3 methods to sort the output from solr 4.3.1., no error and not > sorting on any given field. > 1)addSort(field, order) > 2)addOrUpdateSort(field, order) > 3)setSort(field, order) > > my schema setting for the fields i tried are > <field name="CLAI_CLM_NUM" type="string" indexed="true" stored="false" > multiValued="false"/> > <field name="FIRST_NAM" type="string" indexed="true" stored="false" > multiValued="false"/> > <field name="LAST_NAM" type="string" indexed="true" stored="false" > multiValued="false"/> > > Any one please tell me why the sorting is not working?
Here's an example of how to do a sort with SolrJ, assuming query is a SolrQuery object: query.setSort("LAST_NAM", ORDER.asc); You'll need this import: import org.apache.solr.client.solrj.SolrQuery.ORDER; For the example I've just given, you should see "sort=LAST_NAM asc" in your solr log in the parameter list for that query. If that doesn't seem to work, what are you actually seeing? Thanks, Shawn