Create some specialized converter for number

Description

Typically, the numbers are padded to match the alphabetical ordering

007 023 234

This can be done manually through a converter but this would be nice to have it built-in

Activity

Show:

Hardy FerentschikJanuary 15, 2015 at 2:16 PM

With numeric fields and the fact that we index numbers now per default as numeric fields, this issue becomes obsolete.

CalebCApril 24, 2007 at 12:24 AM

The Solr project has already done this with their org.apache.solr.util.NumberUtils utility class:

http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/NumberUtils.java?view=markup

I use this class to provide number sorting in Lucene.

Emmanuel BernardNovember 2, 2006 at 7:07 PM
Edited

Handling signed elements is not easy.
Basically we need a header such as negative_header < positive-header through natural comparator
Plus for negative numbers we have to invert them so that -3 < -2 and not the other way around with a natural omparator

@Pad(shift=4, signed=true)

or

@Pad(max=9999, signed=true)

Note that decimals are harmless

Also the Lucene recommendation is to use a Query filter rather than a RangeQuery, but ihis will defect the firstResult / maxResult

Out of Date

Details

Assignee

Reporter

Priority

Created June 9, 2006 at 2:32 AM
Updated January 15, 2015 at 2:18 PM
Resolved January 15, 2015 at 2:16 PM

Flag notifications