Reputation: 42
I'm creating a service to display taxi available in a range of time near to the user
I have a database containing the taxi availability data
id | lat | long | availableFrom | availableTo
n | n | n | timestamp | timestamp
And I'm using a Redis instance to store geospatial data to make fast geospatial queries
taxi
0) taxiId
0) 0) lat
1) long
What I need is to retrieve the taxiId and coordinates to display taxis on a map.
I tough to create a query for taxis in a time range in the SQL database and next merge it with the Redis results but is highly inefficient.
What I can currently do with this configuration is querying for taxis near me, but I can't figure out an efficient way to also filter them by time range.
So how can I retrieve from the database in an efficient way taxis near to the given coordinates that are available in a range of time? Is using only SQL the best way? Is there any service or library to do this?
Upvotes: 1
Views: 87
Reputation: 4052
RediSearch module allows you to combine NUMERIC (timestamp) and GEO (lat,long) filters in the same Redis request.
Upvotes: 3