Module org.apache.lucene.codecs
Class SimpleTextKnnVectorsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.KnnVectorsWriter
-
- org.apache.lucene.codecs.BufferingKnnVectorsWriter
-
- org.apache.lucene.codecs.simpletext.SimpleTextKnnVectorsWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Accountable
public class SimpleTextKnnVectorsWriter extends BufferingKnnVectorsWriter
Writes vector-valued fields in a plain text format
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.codecs.KnnVectorsWriter
KnnVectorsWriter.MergedVectorValues
-
-
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
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
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)
private void
writeByteVectorValue(ByteVectorValues vectors)
void
writeField(FieldInfo fieldInfo, ByteVectorValues byteVectorValues, int maxDoc)
Write the provided byte vector fieldvoid
writeField(FieldInfo fieldInfo, FloatVectorValues floatVectorValues, int maxDoc)
Write the provided float vector fieldprivate 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
writeFloatVectorValue(FloatVectorValues vectors)
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)
-
Methods inherited from class org.apache.lucene.codecs.BufferingKnnVectorsWriter
addField, flush, mergeOneField, ramBytesUsed
-
Methods inherited from class org.apache.lucene.codecs.KnnVectorsWriter
merge
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
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, FloatVectorValues floatVectorValues, int maxDoc) throws java.io.IOException
Description copied from class:BufferingKnnVectorsWriter
Write the provided float vector field- Specified by:
writeField
in classBufferingKnnVectorsWriter
- Throws:
java.io.IOException
-
writeFloatVectorValue
private void writeFloatVectorValue(FloatVectorValues vectors) throws java.io.IOException
- Throws:
java.io.IOException
-
writeField
public void writeField(FieldInfo fieldInfo, ByteVectorValues byteVectorValues, int maxDoc) throws java.io.IOException
Description copied from class:BufferingKnnVectorsWriter
Write the provided byte vector field- Specified by:
writeField
in classBufferingKnnVectorsWriter
- Throws:
java.io.IOException
-
writeByteVectorValue
private void writeByteVectorValue(ByteVectorValues 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
-
-