-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
hello,
i am trying to read and write the index and the vectors from/to file.
here my code:
`
public static void write() throws Exception {
OnHeapGraphIndex index = (OnHeapGraphIndex) builder.getGraph();
var featureId = FeatureId.INLINE_VECTORS;
var inlineVectors = new InlineVectors(dimension);
IntFunction<Feature.State> vectorSupplier = ordinal -> {
VectorFloat<?> vector = vectorValues.getVector(ordinal);
return new InlineVectors.State(vector);
};
try (var writer = new OnDiskGraphIndexWriter.Builder(index, indexPath).with(inlineVectors)
.build()) {
Map<FeatureId, IntFunction<Feature.State>> suppliers = Map.of(featureId, vectorSupplier);
writer.write(suppliers);
}
}
public static void readIndex() throws Exception {
if (!indexPath.toFile().exists())
return;
try (ReaderSupplier readerSupplier = ReaderSupplierFactory.open(indexPath)) {
OnDiskGraphIndex oldIndex = OnDiskGraphIndex.load(readerSupplier);
Map<FeatureId, ? extends Feature> features = oldIndex.getFeatures();
InlineVectors ivFeature = (InlineVectors) oldIndex.getFeatures().get(FeatureId.INLINE_VECTORS);
//??
builder = new GraphIndexBuilder(scoreProvider, dimension, 16, 100, 1.2f, 1.2f, true);
}
}
`
Question: how to reconstruct MapRandomAccessVectorValues from InlineVectors ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels