lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Alphanumeric Field Comparison : Lucene 4.5
Date Tue, 12 Nov 2013 08:26:57 GMT
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: uwe@thetaphi.de

 

From: Umashanker, Srividhya [mailto:srividhya.umashanker@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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message