Skip to content

Commit

Permalink
Set IdentityMapper maxOrdinal correctly in Grid/SiftSmall. (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkni authored Aug 12, 2024
1 parent 1dc1b88 commit 15671a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private static BuilderWithSuppliers builderWithSuppliers(Set<FeatureId> features
ProductQuantization pq)
throws FileNotFoundException
{
var identityMapper = new OrdinalMapper.IdentityMapper(onHeapGraph.getIdUpperBound() - 1);
var identityMapper = new OrdinalMapper.IdentityMapper(floatVectors.size() - 1);
var builder = new OnDiskGraphIndexWriter.Builder(onHeapGraph, outPath).withMapper(identityMapper);
Map<FeatureId, IntFunction<Feature.State>> suppliers = new EnumMap<>(FeatureId.class);
for (var featureId : features) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static void siftDiskAnnLTM(List<VectorFloat<?>> baseVectors, List<VectorF
// explicit Writer for the first time, this is what's behind OnDiskGraphIndex.write
OnDiskGraphIndexWriter writer = new OnDiskGraphIndexWriter.Builder(builder.getGraph(), indexPath)
.with(new InlineVectors(ravv.dimension()))
.withMapper(new OrdinalMapper.IdentityMapper(builder.getGraph().getIdUpperBound() - 1))
.withMapper(new OrdinalMapper.IdentityMapper(baseVectors.size() - 1))
.build();
// output for the compressed vectors
DataOutputStream pqOut = new DataOutputStream(new BufferedOutputStream(Files.newOutputStream(pqPath))))
Expand Down

0 comments on commit 15671a9

Please sign in to comment.