Seems like it’s impossible to use Atlas Vector Search together with any kind of geospatial filtering like $geoWithin. (Except for the now deprecated KnnBeta in Atlas Search)
I would love if you could make it possible to use vector search together with a geospatial query!
Hey Dave, yea me too, thanks though. KnnBeta is deprecated now and I remember at one point running into some limitations using the Atlas Search filters vs just using a $match stage when you need to do some complex stuff, so I didn’t bother trying to make it work for now.
I worked on a workaround for that limitations using first a process that does a $merge of a geo query into a vector index temp (staging) collection and then running a similarity search.
You can see how it works in this hugging face space :
So glad to see more requests for this! This is something I have been requesting for a while, and though it’s not yet supported, there are ways you can implement the same (ish) solution using comparison query operators on your location field (or whatever you are using to store your lat/lng).
If you’re trying to emulate $geoWithin, you can instead create a bounding box by calculating the min/max latitude and longitude values, respectively (4 total values). Then, you can add a $filter field within your vector search to only accept latitude and longitude values that fall within these ranges.
I implemented this solution just a few days ago, and it has made a significant impact on our vector search performance. Hope this helps!