Hi,
I am planning to utilize Atlas Vector Search for my product, and I believe it could greatly benefit my project. However, I may require some assistance to ensure it aligns with my goals.
I referred to this documentation and I am able to get the results.
However, just getting the semantically similar results would not suffice my goals. I would also need the similarity score along with each matching result.
Do I need to make changes in my python script as well as the vector search index?
Any guidance or support you could provide in this regard would be greatly appreciated.
Hi @Jayakrishna_Manokaran - welcome to the MongoDB community forums!
You need to add an extra stage to your aggregation pipeline, to add in a field containing the similarity score:
db.embedded_movies.aggregate([
{
"$search": {
# ...
}
}
},
{
"$project": {
"_id": 0,
"plot": 1,
"title": 1,
"score": { $meta: "searchScore" }
}
}
])
I took this example from the MongoDB Vector Search documentation in case you find it useful.
Hope this helps!
Mark
3 Likes
@Mark_Smith
this approach did not work
db.embedded_movies.aggregate([
{
"$search": {
# ...
}
}
},
{
"$project": {
"_id": 0,
"plot": 1,
"title": 1,
"score": { $meta: "searchScore" }
}
}
])