@@ -77,9 +77,9 @@ public class OnHeapGraphIndexTest extends RandomizedTest {
7777 private BuildScoreProvider baseBuildScoreProvider ;
7878 private BuildScoreProvider newBuildScoreProvider ;
7979 private BuildScoreProvider allBuildScoreProvider ;
80- private OnHeapGraphIndex baseGraphIndex ;
81- private OnHeapGraphIndex newGraphIndex ;
82- private OnHeapGraphIndex allGraphIndex ;
80+ private ImmutableGraphIndex baseGraphIndex ;
81+ private ImmutableGraphIndex newGraphIndex ;
82+ private ImmutableGraphIndex allGraphIndex ;
8383
8484 @ Before
8585 public void setup () throws IOException {
@@ -149,7 +149,7 @@ public void testReconstructionOfOnHeapGraphIndex() throws IOException {
149149 TestUtil .writeGraph (baseGraphIndex , baseVectorsRavv , graphOutputPath );
150150
151151 log .info ("Writing neighbors score cache to {}" , neighborsScoreCacheOutputPath );
152- final NeighborsScoreCache neighborsScoreCache = new NeighborsScoreCache (baseGraphIndex );
152+ final NeighborsScoreCache neighborsScoreCache = new NeighborsScoreCache (( OnHeapGraphIndex ) baseGraphIndex );
153153 try (SimpleWriter writer = new SimpleWriter (neighborsScoreCacheOutputPath .toAbsolutePath ())) {
154154 neighborsScoreCache .write (writer );
155155 }
@@ -182,14 +182,14 @@ public void testReconstructionOfOnHeapGraphIndex() throws IOException {
182182 public void testIncrementalInsertionFromOnDiskIndex () throws IOException {
183183 var outputPath = testDirectory .resolve ("testReconstructionOfOnHeapGraphIndex_" + baseGraphIndex .getClass ().getSimpleName ());
184184 log .info ("Writing graph to {}" , outputPath );
185- final NeighborsScoreCache neighborsScoreCache = new NeighborsScoreCache (baseGraphIndex );
185+ final NeighborsScoreCache neighborsScoreCache = new NeighborsScoreCache (( OnHeapGraphIndex ) baseGraphIndex );
186186 TestUtil .writeGraph (baseGraphIndex , baseVectorsRavv , outputPath );
187187 try (var readerSupplier = new SimpleMappedReader .Supplier (outputPath .toAbsolutePath ());
188188 var onDiskGraph = OnDiskGraphIndex .load (readerSupplier )) {
189189 TestUtil .assertGraphEquals (baseGraphIndex , onDiskGraph );
190190 // We will create a trivial 1:1 mapping between the new graph and the ravv
191191 final int [] graphToRavvOrdMap = IntStream .range (0 , allVectorsRavv .size ()).toArray ();
192- OnHeapGraphIndex reconstructedAllNodeOnHeapGraphIndex = GraphIndexBuilder .buildAndMergeNewNodes (onDiskGraph , neighborsScoreCache , allVectorsRavv , allBuildScoreProvider , NUM_BASE_VECTORS , graphToRavvOrdMap , BEAM_WIDTH , NEIGHBOR_OVERFLOW , ALPHA , ADD_HIERARCHY );
192+ ImmutableGraphIndex reconstructedAllNodeOnHeapGraphIndex = GraphIndexBuilder .buildAndMergeNewNodes (onDiskGraph , neighborsScoreCache , allVectorsRavv , allBuildScoreProvider , NUM_BASE_VECTORS , graphToRavvOrdMap , BEAM_WIDTH , NEIGHBOR_OVERFLOW , ALPHA , ADD_HIERARCHY );
193193
194194 // Verify that the recall is similar
195195 float recallFromReconstructedAllNodeOnHeapGraphIndex = calculateRecall (reconstructedAllNodeOnHeapGraphIndex , allBuildScoreProvider , queryVector , groundTruthAllVectors , TOP_K );
@@ -231,7 +231,7 @@ private static int[] getGroundTruth(RandomAccessVectorValues ravv, VectorFloat<?
231231 return exactResults .stream ().limit (topK ).mapToInt (nodeScore -> nodeScore .node ).toArray ();
232232 }
233233
234- private static float calculateRecall (OnHeapGraphIndex graphIndex , BuildScoreProvider buildScoreProvider , VectorFloat <?> queryVector , int [] groundTruth , int k ) throws IOException {
234+ private static float calculateRecall (ImmutableGraphIndex graphIndex , BuildScoreProvider buildScoreProvider , VectorFloat <?> queryVector , int [] groundTruth , int k ) throws IOException {
235235 try (GraphSearcher graphSearcher = new GraphSearcher (graphIndex )){
236236 SearchScoreProvider ssp = buildScoreProvider .searchProviderFor (queryVector );
237237 var searchResults = graphSearcher .search (ssp , k , Bits .ALL );
0 commit comments