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

Commit

Permalink
recall bug fix for odfe>=1.8 (#155)
Browse files Browse the repository at this point in the history
* recall bug fix for odfe>=1.8
  • Loading branch information
vamshin committed Jul 1, 2020
1 parent 2f0d23e commit 5663cdc
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 5663cdc

Please sign in to comment.