Class SimpleTextKnnVectorsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.KnnVectorsWriter
-
- org.apache.lucene.codecs.simpletext.SimpleTextKnnVectorsWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class SimpleTextKnnVectorsWriter extends KnnVectorsWriter
Writes vector-valued fields in a plain text format
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static BytesRefFIELD_NAME(package private) static BytesRefFIELD_NUMBERprivate IndexOutputmetaprivate BytesRefBuilderscratch(package private) static BytesRefSIZE(package private) static BytesRefVECTOR_DATA_LENGTH(package private) static BytesRefVECTOR_DATA_OFFSET(package private) static BytesRefVECTOR_DIMENSIONprivate IndexOutputvectorData
-
Constructor Summary
Constructors Constructor Description SimpleTextKnnVectorsWriter(SegmentWriteState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidfinish()Called once at the end before closeprivate voidnewline(IndexOutput out)private voidwrite(IndexOutput out, java.lang.String s)private voidwrite(IndexOutput out, BytesRef b)voidwriteField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader)Write all values contained in the provided readerprivate voidwriteField(IndexOutput out, BytesRef fieldName, int value)private voidwriteField(IndexOutput out, BytesRef fieldName, long value)private voidwriteField(IndexOutput out, BytesRef fieldName, java.lang.String value)private voidwriteInt(IndexOutput out, int x)private voidwriteLong(IndexOutput out, long x)private voidwriteMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, java.util.List<java.lang.Integer> docIds)private voidwriteVectorValue(VectorValues vectors)-
Methods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
merge
-
-
-
-
Field Detail
-
FIELD_NUMBER
static final BytesRef FIELD_NUMBER
-
FIELD_NAME
static final BytesRef FIELD_NAME
-
VECTOR_DATA_OFFSET
static final BytesRef VECTOR_DATA_OFFSET
-
VECTOR_DATA_LENGTH
static final BytesRef VECTOR_DATA_LENGTH
-
VECTOR_DIMENSION
static final BytesRef VECTOR_DIMENSION
-
SIZE
static final BytesRef SIZE
-
meta
private final IndexOutput meta
-
vectorData
private final IndexOutput vectorData
-
scratch
private final BytesRefBuilder scratch
-
-
Constructor Detail
-
SimpleTextKnnVectorsWriter
SimpleTextKnnVectorsWriter(SegmentWriteState state) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeField
public void writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader) throws java.io.IOException
Description copied from class:KnnVectorsWriterWrite all values contained in the provided reader- Specified by:
writeFieldin classKnnVectorsWriter- Throws:
java.io.IOException
-
writeVectorValue
private void writeVectorValue(VectorValues vectors) throws java.io.IOException
- Throws:
java.io.IOException
-
writeMeta
private void writeMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, java.util.List<java.lang.Integer> docIds) throws java.io.IOException
- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionDescription copied from class:KnnVectorsWriterCalled once at the end before close- Specified by:
finishin classKnnVectorsWriter- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
writeField
private void writeField(IndexOutput out, BytesRef fieldName, int value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeField
private void writeField(IndexOutput out, BytesRef fieldName, long value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeField
private void writeField(IndexOutput out, BytesRef fieldName, java.lang.String value) throws java.io.IOException
- Throws:
java.io.IOException
-
write
private void write(IndexOutput out, java.lang.String s) throws java.io.IOException
- Throws:
java.io.IOException
-
writeInt
private void writeInt(IndexOutput out, int x) throws java.io.IOException
- Throws:
java.io.IOException
-
writeLong
private void writeLong(IndexOutput out, long x) throws java.io.IOException
- Throws:
java.io.IOException
-
write
private void write(IndexOutput out, BytesRef b) throws java.io.IOException
- Throws:
java.io.IOException
-
newline
private void newline(IndexOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
-