Bug description I am having trouble with MongoDBAtlasVectorStore. Basically when I copy and paste this into my project because the similarity search isn't working...
List<Document> ds = List.of(
new Document(
"Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!! Spring AI rocks!!",
Collections.singletonMap("meta1", "meta1")),
new Document("Hello World Hello World Hello World Hello World Hello World Hello World Hello World"),
new Document(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression",
Collections.singletonMap("meta2", "meta2")));
vectorStore.add(ds);
Thread.sleep(25000); // Await a second for the document to be indexed
List<Document> results = vectorStore.similaritySearch(SearchRequest.query("Great").withTopK(1));
The result I see is not correct...
Environment Java 23 Spring AI 1.0.0-M3
Steps to reproduce See repo here. You can add the code above to that and see it doesn't work
Expected behavior I would expect it to return a document as it does in the test.
Minimal Complete Reproducible example See above more available here
Comment From: jrgleason
Got debugging into source working now trying to understand why the query is returning 0 records. Also running the build locally with mvn clean install
to make sure it isn't an environment issue.
Comment From: jrgleason
It seems that the way the vector store is working isn't allowing me to aggregate properly. I added a script
https://github.com/jrgleason/spring-ai-example/blob/ADD_MQTT_SUPPORT/app/debug/mongodb/test-count.js
That seems to confirm this can someone see what I am doing wring with my config?
Comment From: ilayaperumalg
@jrgleason Sorry about the experience with the local testing and the delay in getting back to you. The MongoDB vector store and the vector store in general went through significant change since you reported. Could you try the latest Spring AI 1.0 and let us know if you still see the problem? Thanks
Closing this for now and please feel free to re-open the issue.