redis-developer / introducing-the-geosearch-command

Demo application using a Bulma / Leaflet JS / JavaScript front end and Python / Flask backend to demonstrate the GEOSEARCH command added in Redis 6.2.
https://developer.redis.com/
MIT License
14 stars 13 forks source link

Enhance the application backend with RediSearch #11

Closed simonprickett closed 2 years ago

simonprickett commented 2 years ago

This application stores its station data in two places... a Redis geo key containing all stations, and a series of Redis Hashes - one for each station. Currently, the application does nothing with the data in the Hashes whose keys are of the form station:<stationName>.

Here's Ashby for example:

127.0.0.1:6379> hgetall station:ashby
 1) "altitudeMode"
 2) "clampToGround"
 3) "City"
 4) "Berkeley"
 5) "AssetType"
 6) "Station"
 7) "Long"
 8) "-122.269981"
 9) "Street"
10) "3100 Adeline Street"
11) "FID"
12) "45"
13) "Lat"
14) "37.85257"
15) "Field_1"
16) "Ashby"

Update the application to use RediSearch as follows:

@app.route("/api/search/bycity/<city_name>")
def search_by_city_name(city_name):
  # TODO code here...
[
  {
    "name": "<station name>",
    "city": "<station city>",
    "location": {
        "latitude": <station latitude>,
        "longitude": <station longitude>
    }
  }
]

This is part of our participation in Hacktoberfest 2021. Learn how to complete this issue here: https://developer.redis.com/hacktoberfest/

Need help or want to talk to us? Join us on Discord where we have a dedicated Hacktoberfest channel: https://discord.gg/ueQwKUh5Z3

teezzan commented 2 years ago

Can I hop on this?

SuzeShardlow commented 2 years ago

Yes @teezzan :) Please check out our guidelines at developer.redis.com/hacktoberfest and we look forward to seeing something from you in a couple of days :)

simonprickett commented 2 years ago

@teezzan hope all is well. Let us know if you need help or advice here.

teezzan commented 2 years ago

I'm sorry. I am starting ~tomorrow~ now. Thanks for checking on me.