Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback: GEOSEARCH #937

Open
sivakumar-74 opened this issue Nov 29, 2024 · 2 comments
Open

Feedback: GEOSEARCH #937

sivakumar-74 opened this issue Nov 29, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sivakumar-74
Copy link

Page https://redis.io/docs/latest/commands/geosearch/

Pls add sample code implementation for these commands in all the supported programming languages

It is so frustrating I can't find a single implementation for these commands, not only Geosearch, Geosearch with all the geo search related queries.

@dwdougherty
Copy link
Collaborator

dwdougherty commented Dec 2, 2024

Hi @sivakumar-74. Thank you for reaching out.

Eventually, all command pages will have code examples. In the interim, you can trying asking the Redis Copilot for help. For example, I asked it "How to use the GEOSEARCH command with Python?", and it replied with the following:

To use the GEOSEARCH command with Python, you can utilize the redis-py library, which is a Python client for Redis. Here is a basic example of how you can use GEOSEARCH:

import redis

# Connect to Redis
client = redis.StrictRedis(host='localhost', port=6379, decode_responses=True)

# Add some geospatial items
client.geoadd('cities', {'longitude': 13.361389, 'latitude': 38.115556, 'catania': 1})
client.geoadd('cities', {'longitude': 15.087269, 'latitude': 37.502669, 'palermo': 2})

# Use the GEOSEARCH command
result = client.execute_command('GEOSEARCH', 'cities', 'FROMMEMBER', 'catania', 'BYRADIUS', 100, 'km', 'ASC')

print(result)  # Outputs the members within 100 km from Catania, sorted by distance

Make sure you have the redis-py library installed, which you can do by running pip install redis.

The GEOSEARCH command can search members in a geospatial index using a variety of parameters such as radius, box, member, etc. The above code demonstrates searching within a radius from a specified member. Adjust the parameters as needed for your specific use case.

If you need more detailed documentation on these commands, please refer to the Redis documentation or the redis-py library documentation.

Given that adding examples to every command page is already a roadmap item, may I close this ticket?

@dwdougherty dwdougherty self-assigned this Dec 2, 2024
@dwdougherty dwdougherty added the enhancement New feature or request label Dec 2, 2024
@sivakumar-74
Copy link
Author

Hi @dwdougherty,

Thank you for your response.

It was good to know there is an AI chat for Redis command queries. I have tried it and found that it provides correct answers. However, I encountered issues with Node.js-specific functions. I have attached a screenshot for your reference.

One thing I didn't know was that there is AI to help with documentation in Redis. It would be helpful if you could add an icon in the documentation to ask Redis Copilot. I have attached a screenshot with my suggestion.

Thanks again for your assistance.

Encountered issue with node specific function

image

Suggestion

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants