java.lang.Object
org.elasticsearch.common.lucene.BytesRefs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.lucene.util.BytesRefcheckIndexableLength(org.apache.lucene.util.BytesRef input) Checks that the input is not longer thanIndexWriter.MAX_TERM_LENGTHstatic org.apache.lucene.util.BytesReftoBytesRef(Object value) Converts an object value to BytesRef.static org.apache.lucene.util.BytesRefConverts a given string to aBytesRefobject with an exactly sized byte array.static StringConverts a value to a string, taking special care if its aBytesRefto callBytesRef.utf8ToString().
-
Constructor Details
-
BytesRefs
public BytesRefs()
-
-
Method Details
-
toString
Converts a value to a string, taking special care if its aBytesRefto 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 aBytesRefobject with an exactly sized byte array.This method alternative method to the standard
BytesRefconstructor'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
-