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 BytesRef
FIELD_NAME
(package private) static BytesRef
FIELD_NUMBER
private IndexOutput
meta
private BytesRefBuilder
scratch
(package private) static BytesRef
SIZE
(package private) static BytesRef
VECTOR_DATA_LENGTH
(package private) static BytesRef
VECTOR_DATA_OFFSET
(package private) static BytesRef
VECTOR_DIMENSION
private IndexOutput
vectorData
-
Constructor Summary
Constructors Constructor Description SimpleTextKnnVectorsWriter(SegmentWriteState state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
finish()
Called once at the end before closeprivate void
newline(IndexOutput out)
private void
write(IndexOutput out, java.lang.String s)
private void
write(IndexOutput out, BytesRef b)
void
writeField(FieldInfo fieldInfo, KnnVectorsReader knnVectorsReader)
Write all values contained in the provided readerprivate void
writeField(IndexOutput out, BytesRef fieldName, int value)
private void
writeField(IndexOutput out, BytesRef fieldName, long value)
private void
writeField(IndexOutput out, BytesRef fieldName, java.lang.String value)
private void
writeInt(IndexOutput out, int x)
private void
writeLong(IndexOutput out, long x)
private void
writeMeta(FieldInfo field, long vectorDataOffset, long vectorDataLength, java.util.List<java.lang.Integer> docIds)
private void
writeVectorValue(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:KnnVectorsWriter
Write all values contained in the provided reader- Specified by:
writeField
in 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.IOException
Description copied from class:KnnVectorsWriter
Called once at the end before close- Specified by:
finish
in 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
-
-