Package ai.preferred.cerebro.index.store
Class VectorField
- java.lang.Object
-
- org.apache.lucene.document.Field
-
- org.apache.lucene.document.StoredField
-
- ai.preferred.cerebro.index.store.VectorField
-
- All Implemented Interfaces:
org.apache.lucene.index.IndexableField
public class VectorField extends org.apache.lucene.document.StoredField
Cerebro's class to store a vector into Lucene's index.
-
-
Constructor Summary
Constructors Constructor Description VectorField(double[] data)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]
getFeatureVector(byte[] data)
static byte[]
vecToBytes(double[] doublearr)
-
Methods inherited from class org.apache.lucene.document.Field
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue, toString
-
-
-
-
Method Detail
-
vecToBytes
public static byte[] vecToBytes(double[] doublearr)
- Parameters:
doublearr
-- Returns:
- byte encoding of the vector. Encoding a vector into an array of byte.
-
getFeatureVector
public static double[] getFeatureVector(byte[] data)
- Parameters:
data
-- Returns:
- vector values of a byte array. Decode a byte array back into a vector.
-
-