On Fri, Feb 15, 2008 at 3:36 AM, Mahesh Udupa <[EMAIL PROTECTED]> wrote: > Thanks Yonik, > > It works fine. But sort is *case sensitive. * > And also, > If my String contains some white space(or - or any other special char) then > failed to sort, with following error. > > INFO: /select/ > version=2.2&rows=20&fl=rcid,status,categoryid,cmprice_value,cmprice_model,cmprice_noofdays,cmprice_nooftimes,cmprice_freqocc,cmprice_startdate,cmprice_enddate,title,devname,category,cmprice,shortdesc,ctype,score&start=0&q=%2Bstatus:published+%2Bplanid:1;title+asc > 0 4 > Feb 15, 2008 1:40:47 PM org.apache.solr.core.SolrException log > SEVERE: java.lang.RuntimeException: there are more terms than documents in > field "title", but it's impossible to sort on tokenized fields > > I have used title as follows > <copyField source="title" dest="title_exact"/> > <field name="title_exact" type="string" indexed="true" stored="true"/> > > So how can I make sure that sort is case in-sensitive, works for special > chars and numeric fields?
Make a custom fieldType, starting with the TextField type and specifying the analyzer to use a keyword tokenizer followed by a lowercase filter. The do the copyField (as you have done above). Then actually sort by the title_exact field (your example query shows you still sorting by "title"). You probably want to use a separate sort parameter: sort=text_exact desc -Yonik