Skip to content

Commit

Permalink
jVector changes are backwards compatible with integ tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-herman committed Feb 7, 2025
1 parent efdc583 commit 3e86bfc
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,24 @@ public FieldEntry(
final Path indexFilePath;
final long sliceOffset;
if (state.segmentInfo.getUseCompoundFile()) {
JVectorCompoundFormat.JVectorCompoundReader jVectorCompoundReader = (JVectorCompoundFormat.JVectorCompoundReader) directory;
sliceOffset = jVectorCompoundReader.getOffsetInCompoundFile(originalIndexFileName);
indexFilePath = jVectorCompoundReader.getCompoundFilePath();
if (directory instanceof JVectorCompoundFormat.JVectorCompoundReader) {
JVectorCompoundFormat.JVectorCompoundReader jVectorCompoundReader = (JVectorCompoundFormat.JVectorCompoundReader) directory;
sliceOffset = jVectorCompoundReader.getOffsetInCompoundFile(originalIndexFileName);
indexFilePath = jVectorCompoundReader.getCompoundFilePath();
} else if (directory instanceof KNN80CompoundDirectory) {
KNN80CompoundDirectory knn80CompoundDirectory = (KNN80CompoundDirectory) directory;
JVectorCompoundFormat.JVectorCompoundReader jVectorCompoundReader = new JVectorCompoundFormat.JVectorCompoundReader(
knn80CompoundDirectory.getDelegate(),
knn80CompoundDirectory.getDir(),
state.segmentInfo,
state.context
);
sliceOffset = jVectorCompoundReader.getOffsetInCompoundFile(originalIndexFileName);
indexFilePath = jVectorCompoundReader.getCompoundFilePath();
} else {
throw new IllegalArgumentException("directory must be JVectorCompoundFormat or KNN80CompoundDirectory but instead had type: " + directory.getClass().getName());
}

} else {
sliceOffset = 0;
indexFilePath = expectedIndexFilePath;
Expand Down

0 comments on commit 3e86bfc

Please sign in to comment.