go-faiss
go-faiss copied to clipboard
`AddWithIDs` throws "add_with_ids not implemented for this type of index" with `IndexFactory`-created Flat index
Title: AddWithIDs throws "add_with_ids not implemented for this type of index" with IndexFactory-created Flat index
Description:
I'm trying to add vectors with custom IDs using AddWithIDs on an index created via IndexFactory with Flat type, but getting an error indicating the method isn't implemented for this index type.
Reproduction Steps:
package main
import "github.com/DataIntelligenceCrew/go-faiss"
func main() {
test01()
}
func test01() {
// Create Flat index via IndexFactory
index, _ := faiss.IndexFactory(32, "Flat", faiss.MetricInnerProduct)
// Add vector with custom ID
vectors := [][]float32{
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32},
}
err := index.AddWithIDs(vectors[0], []int64{22}) // <-- Error occurs here
print(err)
}