Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

recall bug fix for odfe>=1.8 #246

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.util.BytesRef;

import java.io.ByteArrayInputStream;
import java.io.IOException;
Expand All @@ -43,10 +44,9 @@ public static KNNCodecUtil.Pair getFloats(BinaryDocValues values) throws IOExcep
ArrayList<float[]> vectorList = new ArrayList<>();
ArrayList<Integer> docIdList = new ArrayList<>();
for (int doc = values.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = values.nextDoc()) {
byte[] value = values.binaryValue().bytes;

try (ByteArrayInputStream byteStream = new ByteArrayInputStream(value);
ObjectInputStream objectStream = new ObjectInputStream(byteStream)) {
BytesRef bytesref = values.binaryValue();
try (ByteArrayInputStream byteStream = new ByteArrayInputStream(bytesref.bytes, bytesref.offset, bytesref.length);
ObjectInputStream objectStream = new ObjectInputStream(byteStream)) {
float[] vector = (float[]) objectStream.readObject();
vectorList.add(vector);
} catch (ClassNotFoundException e) {
Expand Down