FYI, this Jira ticket might be related to your question... you can check the patch. https://issues.apache.org/jira/browse/SOLR-1672
2015-02-04 11:41 GMT+09:00 Tomoko Uchida <tomoko.uchida.1...@gmail.com>: > Hi, > > > I have been trying to find out a way to get the facet results in > ascending order of counts. I could not look up online to find a way to do > this. > > In short answer, Solr only supports facet results sorting by descending > order of counts, or lexicographical order of terms. > See the description for "facet.sort" parameter. > https://cwiki.apache.org/confluence/display/solr/Faceting > > I do not come up with easy solution (that may not be a common use case, I > think.) > *If you have relatively small docs for faceting, and your facet fields > have small unique values* you cat get all (or tail) facet results and > reverse the results. > There should be significant performance impact if the fields have large > unique values and/or you have large docs for faceting. > > Regards, > Tomoko > > 2015-02-04 8:21 GMT+09:00 harish singh <harish.sing...@gmail.com>: > >> Hi, >> >> I am trying get the results of my facet-query in a sorted order. >> >> This is the code snippet: >> >> SolrQuery solrQuery = new SolrQuery(); >> solrQuery.setFacet(true); >> solrQuery.setFacetLimit(100); >> solrQuery.setFacetMinCount(1); >> solrQuery.setStart(0); >> solrQuery.setRows(0); >> solrQuery .addFacetFeilds("loginUser"); >> solrQuery.setFacetSort(FacetParams.FACET_SORT_COUNT); >> >> When I do "solrQuery.setFacetSort(FacetParams.FACET_SORT_COUNT)", it sorts >> the results in Descending order of counts. >> >> I have been trying to find out a way to get the facet results in ascending >> order of counts. I couldnot look up online to find a way to do this. >> >> Is there a way to achieve this? >> >> Thanks, >> Harish >> > >