Hi,

 

What are you intending to do? The example code is lost!

In general, to sort alphanumeric/lexical on a human readable field, you would 
use the collation functionalities (needs a separate field for sorting 
containing the collation keys) provided by Lucene.

Use 
http://lucene.apache.org/core/4_5_1/analyzers-common/org/apache/lucene/collation/CollationKeyAnalyzer.html
 to index the field and then you can do a simple native sort on this field 
(SortField.STRING).

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: u...@thetaphi.de

 

From: Umashanker, Srividhya [mailto:srividhya.umashan...@hp.com] 
Sent: Tuesday, November 12, 2013 5:00 AM
To: java-user@lucene.apache.org
Subject: Alphanumeric Field Comparison : Lucene 4.5

 

Group –

 

We are looking at sorting lucene doc’s based on a field in alphanumeric order, 
as we expect fields to have Alpha numeric characters.

Attached is the AlphaNumericFieldComparatorSource and below is the snippet of 
its usage.

 

final SortField sortField_id = new SortField(FieldName._id.name(), new 
AlphaNumericFieldComparatorSource(), false);

 

Is anyone using an easier approach or please share other alternatives that you 
have tried.

 

Thanks!

 

-Vidhya

Reply via email to