I have multiple geolocations stored in a Redis database (version 7.2.4) in the following format:
GEOADD locations -46.63803300 (longitude) -23.53523600 (latitude) "270353275" (ID)
In Node.js (v13.5.0), I want to search for which geolocations are contained inside a given polygon.
Input: Geolocations of the polygon vertices are provided in the following format:
"bounds": [ { "lat": -23.534717280387206, "lng": -46.602115631103516 }, { "lat": -23.548251460987665, "lng": -46.623573303222656 }, ... ]
Output: IDs of the geolocations that are inside this polygon.
I’m trying to use the ‘redis-redisearch’ (^1.0.1) library with the ‘ioredis’ (v4.28.5) library in the following way:
`const redis = await getRedis() //returns new Redis client
redisearch(redis)
const results = await redis.ft_search(
“announces”,
@location:{${polygon_query}}
,
“RETURN”,
“1”,
“@location”
)`
However, I’m receiving the error “redis.addCommand is not a function”. How can I implement this functionality?”
luccassaliba is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.