There's no good way of enforcing this as far as I know as you've outlined the problem. You can easily specify multiple sort criteria, where ties in the first criteria are broken by the second criteria and so on.
So, if your records have *no* city value you can do what you want by specifying the city field to sortMissingLast then specifying state as your second criteria. So you can probably do what you want by breaking up your location field into fields that are specific for sorting (probably use copyfield here?) and specifying as above. Best Erick On Sun, Jan 1, 2012 at 3:19 AM, Gupta, Veeranjaneya <veeranjaneya.gu...@travelocity.com> wrote: > Hi, > > I use Solr 1.4 version and I have a question about SOLR sort order. > Requirement : Sort names(e.g. : location names like Dallas(City), las > vegas(City), Texas(State), India(Country), Canada(Country), etc..) based on > category(e.g. : CITY, STATE, COUNTRY, etc..) > How to sort the SOLR results based on custom order? > Expected result : > > 1. Dallas > > 2. Las Vegas > > 3. Texas > > 4. Canada > > 5. India > > Thanks & Regards, Gupta