lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ganesh" <emailg...@yahoo.co.in>
Subject Re: how to sort the result by ignoring case in lucene
Date Fri, 21 Nov 2008 06:05:40 GMT
You need to write your own sort comparator
SortField(String field, SortComparatorSource comparator)

Regards
Ganesh

----- Original Message ----- 
From: "naveen.quill" <naveen.verus@gmail.com>
To: <java-user@lucene.apache.org>
Sent: Friday, November 21, 2008 11:27 AM
Subject: how to sort the result by ignoring case in lucene


>
> Hi,
>
> I have a query regarding the sorting techniques in the lucene i.e
> if i apply the sort method to the search results, lucene is sorting the
> results by, without ignoring case, so, how to apply the sort technique 
> that
> it should sort by ignoring case
>
> i.e :
> if the results value are : {ACB, abc, adc, Aad},
> After sorting the results by lucene : {Aad, ACB, abc, adc} [here the 
> lucene
> is taking uppercase words first to sort the results then lowercase],
> but i need to get the results in this order : {Aad, abc, ACB, adc}
>
> so how to sort the results by ignoring case
>
> here is my code :
> String queryComplex = "110_a_t:a* 110_a_t:A*";
> SortField sortField = new SortField("110_a_t", SortField.STRING);
> Sort sort = new Sort(sortField);
> QueryParser queryParser=new QueryParser("",new StandardAnalyzer());
> queryParser.setLowercaseExpandedTerms(false);
> Query query = queryParser.parse(queryComplex);
> org.apache.lucene.search.Hits
> catalogueHits=search.indexSearcher.search(query, sort);
> -- 
> View this message in context: 
> http://www.nabble.com/how-to-sort-the-result-by-ignoring-case-in-lucene-tp20615647p20615647.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

Send instant messages to your online friends http://in.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message