java.lang.Object
org.elasticsearch.common.lucene.BytesRefs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.lucene.util.BytesRef
checkIndexableLength
(org.apache.lucene.util.BytesRef input) Checks that the input is not longer thanIndexWriter.MAX_TERM_LENGTH
static org.apache.lucene.util.BytesRef
toBytesRef
(Object value) Converts an object value to BytesRef.static org.apache.lucene.util.BytesRef
Converts a given string to aBytesRef
object with an exactly sized byte array.static String
Converts a value to a string, taking special care if its aBytesRef
to callBytesRef.utf8ToString()
.
-
Constructor Details
-
BytesRefs
public BytesRefs()
-
-
Method Details
-
toString
Converts a value to a string, taking special care if its aBytesRef
to callBytesRef.utf8ToString()
. -
toBytesRef
Converts an object value to BytesRef. -
checkIndexableLength
public static org.apache.lucene.util.BytesRef checkIndexableLength(org.apache.lucene.util.BytesRef input) Checks that the input is not longer thanIndexWriter.MAX_TERM_LENGTH
- Parameters:
input
- a BytesRef- Returns:
- the same BytesRef, if no exception has been thrown
- Throws:
IllegalArgumentException
- if the input is too long
-
toExactSizedBytesRef
Converts a given string to aBytesRef
object with an exactly sized byte array.This method alternative method to the standard
BytesRef
constructor's allocates the exact byte array size needed for the string. This is done by parsing the UTF-16 string two times the first to estimate the array length and the second to copy the string value inside the array.- Parameters:
s
- the input string to convert- Returns:
- a BytesRef object representing the input string
-