Package org.apache.lucene.document
Class NumberTools
- java.lang.Object
-
- org.apache.lucene.document.NumberTools
-
@Deprecated public class NumberTools extends Object
Deprecated.For new indexes useNumericUtils
instead, which provides a sortable binary representation (prefix encoded) of numeric values. To index and efficiently query numeric values useNumericField
andNumericRangeQuery
. This class is included for use with existing indices and will be removed in a future release (possibly Lucene 4.0).Provides support for converting longs to Strings, and back again. The strings are structured so that lexicographic sorting order is preserved.That is, if l1 is less than l2 for any two longs l1 and l2, then NumberTools.longToString(l1) is lexicographically less than NumberTools.longToString(l2). (Similarly for "greater than" and "equals".)
This class handles all long values (unlike
DateField
).
-
-
Field Summary
Fields Modifier and Type Field Description static String
MAX_STRING_VALUE
Deprecated.Equivalent to longToString(Long.MAX_VALUE)static String
MIN_STRING_VALUE
Deprecated.Equivalent to longToString(Long.MIN_VALUE)static int
STR_SIZE
Deprecated.The length of (all) strings returned bylongToString(long)
-
Constructor Summary
Constructors Constructor Description NumberTools()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
longToString(long l)
Deprecated.Converts a long to a String suitable for indexing.static long
stringToLong(String str)
Deprecated.Converts a String that was returned bylongToString(long)
back to a long.
-
-
-
Field Detail
-
MIN_STRING_VALUE
public static final String MIN_STRING_VALUE
Deprecated.Equivalent to longToString(Long.MIN_VALUE)- See Also:
- Constant Field Values
-
MAX_STRING_VALUE
public static final String MAX_STRING_VALUE
Deprecated.Equivalent to longToString(Long.MAX_VALUE)- See Also:
- Constant Field Values
-
STR_SIZE
public static final int STR_SIZE
Deprecated.The length of (all) strings returned bylongToString(long)
-
-
Method Detail
-
longToString
public static String longToString(long l)
Deprecated.Converts a long to a String suitable for indexing.
-
stringToLong
public static long stringToLong(String str)
Deprecated.Converts a String that was returned bylongToString(long)
back to a long.- Throws:
IllegalArgumentException
- if the input is nullNumberFormatException
- if the input does not parse (it was not a String returned by longToString()).
-
-