|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.search.impl.lucene.analysis.NumericEncoder
public class NumericEncoder
Support to encode numeric types in the lucene index. To support range queries in the lucene index numeric types need to be indexed specially. This has been addressed for int and long types for lucene and limited support (via scaling) for float and double. The implementation splits an int, long, float or double into the sign bit, optional exponent and mantissa either from the int or long format or its IEEE 754 byte representation. To index content so small negative numbers are indexed correctly and are after big negative numbers in range queries. The algorithm finds the sign, if the number is negative, then the mantissa and exponent are XORed against the appropriate masks. This reverses the order. As negative numbers appear first in the list their sign bit is 0 and positive numbers are 1.
Method Summary | |
---|---|
static int |
decodeInt(java.lang.String hex)
|
static long |
decodeLong(java.lang.String hex)
Secode a long |
static java.lang.String |
encode(double doubleToEncode)
Encode a double into a string that orders correctly according to string comparison. |
static java.lang.String |
encode(float floatToEncode)
Encode a float into a string that orders correctly according to string comparison. |
static java.lang.String |
encode(int intToEncode)
Encode an integer into a string that orders correctly using string comparison Integer.MIN_VALUE encodes as 00000000 and MAX_VALUE as ffffffff. |
static java.lang.String |
encode(long longToEncode)
Encode a long into a string that orders correctly using string comparison Long.MIN_VALUE encodes as 0000000000000000 and MAX_VALUE as ffffffffffffffff. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String encode(int intToEncode)
intToEncode
-
public static java.lang.String encode(long longToEncode)
longToEncode
-
public static long decodeLong(java.lang.String hex)
hex
-
public static int decodeInt(java.lang.String hex)
public static java.lang.String encode(float floatToEncode)
floatToEncode
-
public static java.lang.String encode(double doubleToEncode)
doubleToEncode
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |