Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
<dependency groupId="org.apache.lucene" artifactId="lucene-core" version="9.8.0" />
<dependency groupId="org.apache.lucene" artifactId="lucene-analysis-common" version="9.8.0" />
<dependency groupId="org.apache.lucene" artifactId="lucene-backward-codecs" version="9.8.0" />
<dependency groupId="io.github.jbellis" artifactId="jvector" version="4.0.0-rc.3" />
<dependency groupId="io.github.jbellis" artifactId="jvector" version="4.0.0-rc.5" />
<dependency groupId="com.bpodgursky" artifactId="jbool_expressions" version="1.14" scope="test"/>

<dependency groupId="com.carrotsearch.randomizedtesting" artifactId="randomizedtesting-runner" version="2.1.2" scope="test">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.github.jbellis.jvector.graph.GraphIndex;
import io.github.jbellis.jvector.graph.ImmutableGraphIndex;
import io.github.jbellis.jvector.graph.GraphSearcher;
import io.github.jbellis.jvector.graph.disk.feature.FeatureId;
import io.github.jbellis.jvector.graph.disk.OnDiskGraphIndex;
Expand Down Expand Up @@ -72,7 +72,7 @@ public class CassandraDiskAnn
private final FileHandle graphHandle;
private final OnDiskOrdinalsMap ordinalsMap;
private final Set<FeatureId> features;
private final GraphIndex graph;
private final ImmutableGraphIndex graph;
private final VectorSimilarityFunction similarityFunction;
@Nullable
private final CompressedVectors compressedVectors;
Expand Down Expand Up @@ -231,7 +231,7 @@ public CloseableIterator<RowIdWithScore> search(VectorFloat<?> queryVector,
searcher.usePruning(usePruning);
try
{
var view = (GraphIndex.ScoringView) searcher.getView();
var view = (ImmutableGraphIndex.ScoringView) searcher.getView();
SearchScoreProvider ssp;
// FusedADC can no longer be written due to jvector upgrade. However, it's possible these index files
// still exist, so we have to support them.
Expand Down Expand Up @@ -311,9 +311,9 @@ public OrdinalsView getOrdinalsView()
return ordinalsMap.getOrdinalsView();
}

public GraphIndex.ScoringView getView()
public ImmutableGraphIndex.ScoringView getView()
{
return (GraphIndex.ScoringView) graph.getView();
return (ImmutableGraphIndex.ScoringView) graph.getView();
}

public boolean containsUnitVectors()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

import java.io.Closeable;

import io.github.jbellis.jvector.graph.GraphIndex;
import io.github.jbellis.jvector.graph.ImmutableGraphIndex;
import io.github.jbellis.jvector.graph.similarity.ScoreFunction;
import io.github.jbellis.jvector.vector.VectorSimilarityFunction;
import io.github.jbellis.jvector.vector.types.VectorFloat;
import org.apache.cassandra.io.util.FileUtils;

/**
* An ExactScoreFunction that closes the underlying {@link GraphIndex.ScoringView} when closed.
* An ExactScoreFunction that closes the underlying {@link ImmutableGraphIndex.ScoringView} when closed.
*/
public class CloseableReranker implements ScoreFunction.ExactScoreFunction, Closeable
{
private final GraphIndex.ScoringView view;
private final ImmutableGraphIndex.ScoringView view;
private final ExactScoreFunction scoreFunction;

public CloseableReranker(VectorSimilarityFunction similarityFunction, VectorFloat<?> queryVector, GraphIndex.ScoringView view)
public CloseableReranker(VectorSimilarityFunction similarityFunction, VectorFloat<?> queryVector, ImmutableGraphIndex.ScoringView view)
{
this.view = view;
this.scoreFunction = view.rerankerFor(queryVector, similarityFunction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public long addGraphNode(InsertionResult result)
public SegmentMetadata.ComponentMetadataMap flush() throws IOException
{
// header is required to write the postings, but we need to recreate the writer after that with an accurate OrdinalMapper
writer.writeHeader();
writer.writeHeader(builder.getGraph().getView());
writer.close();

int nInProgress = builder.insertsInProgress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.junit.Test;

import io.github.jbellis.jvector.graph.GraphIndex;
import io.github.jbellis.jvector.graph.ImmutableGraphIndex;
import io.github.jbellis.jvector.graph.NodeQueue;
import io.github.jbellis.jvector.graph.NodesIterator;
import io.github.jbellis.jvector.graph.similarity.ScoreFunction;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void testBruteForceRowIdIteratorForEmptyPQAndTopKEqualsLimit()
assertTrue(view.isClosed);
}

private static class TestView implements GraphIndex.ScoringView
private static class TestView implements ImmutableGraphIndex.ScoringView
{
private boolean isClosed = false;

Expand Down Expand Up @@ -102,7 +102,7 @@ public int size()
}

@Override
public GraphIndex.NodeAtLevel entryNode()
public ImmutableGraphIndex.NodeAtLevel entryNode()
{
throw new UnsupportedOperationException();
}
Expand All @@ -112,5 +112,11 @@ public Bits liveNodes()
{
throw new UnsupportedOperationException();
}

@Override
public boolean contains(int i, int i1)
{
return false;
}
}
}