Lucene Sorting

2013-04-17 Thread pankaj.pandey4
Hi,

We are facing sorting issue on the data indexed using Solr. Below is the sample 
code. Problem is, data returned by the below code is not properly sorted i.e. 
there's no ordering of data. Can anyone assist me on this?

TopDocs topDocs = null;
  Directory directory = FSDirectory.open(indexDir);
  IndexSearcher searcher = new IndexSearcher(IndexReader.open(directory));
Sort column = new Sort(new SortField(sortColumn, SortField.STRING, reverse));
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
queryParser = new QueryParser(Version.LUCENE_36, fieldName, analyzer);
  queryParser.setAllowLeadingWildcard(true);
  queryParser.setDefaultOperator(Operator.AND);
topDocs = searcher.search(queryParser.parse(queryStr), filter, maxHits, column);

Thanks!

Regards,
Pankaj

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com


Re: SOLR/Lucene sorting - Question/ requesting suggestion

2007-11-29 Thread Ryan McKinley

Kasi Sankaralingam wrote:

When we have the following set of data, they are first sorted based on Capital 
letters and then lower case
. Is there a way to make them sort regardless of character case?

Avaneesh
Bruce
Veda
caroleY
jonathan
junit

So carole would come after Bruce. Thanks



sorting is based on the token, not the stored field.  Use a fieldType 
that includes the LowerCaseFilterFactory


Check the 'alphaOnlySort' fieldType in the example schema.xml -- that 
makes a token with lowercase and tosses any non letters (you can get rid 
of the PatternReplaceFilterFactory but it is a good example)


ryan


SOLR/Lucene sorting - Question/ requesting suggestion

2007-11-29 Thread Kasi Sankaralingam
When we have the following set of data, they are first sorted based on Capital 
letters and then lower case
. Is there a way to make them sort regardless of character case?

Avaneesh
Bruce
Veda
caroleY
jonathan
junit

So carole would come after Bruce. Thanks