How to use geo-location filters in search?


Is it possible to use metadata filtering to restrict the results to be within the radius of a geographical point (latitude and longitude)?

For instance, lets say that my index consists of a list of Hotels and I want to find the best match for my semantic vector BUT only within a certain radius of my city. Each hotell might have multiple locations.

Example data:

	"id": "1",
	"metadata": {
		"name": "A great Hotel",
		"locations": [[-77.0364, 38.8951]]
	"values": [-0.031287473, -0.024716083, -0.0017911823, ...]
	"id": "2",
	"metadata": {
		"name": "Another Great Hotel",
		"locations": [[-77.0364, 38.8951],[-77.0364, 38.8951],[-77.0364, 38.8951]]
	"values": [-0.031287473, -0.024716083, -0.0017911823, ...]

How I imagine a query could look like:

    "vector": [0.0040269415, -0.028688831, 0.015932681, -0.02544977,  ...],
    "filter": {
		"locations": {
			"WithinGeoRange": {
				latitude: -77.0364,
				longitude: 38.8951,
				radius: 20

I think you could just filter in your script when you receive the response ?

It seems like a Cartesian Distance function would be among the distance functions available in any vector database. That would be your cutoff value.

It also seems like any vector database would let you set a distance limit for the query results.

I would not use metadata here. I would use the main data directly.

I will now go check the docs to see if it’s all true for Pinecone in particular. I am interested in geo coordinate nearest neighbors too! Nobody seems to talk about using vectors except LLM vectors, but of course other kinds of vectors exist as we know! 2D and 3D are super common space vectors in earth maps and particle computations.

This is functionality that qdrant has:

I’ll probably switch to that unless similar functionality is added to Pinecone soon.

There’s a feature request to add this now, if you could all go and upvote the request it will help get it higher on the team’s radar and hopefully get them to implement it.