RediSearch / redisearch-go

Go client for RediSearch
https://redisearch.io
BSD 3-Clause "New" or "Revised" License
293 stars 65 forks source link

Added example to demonstrate use georadius. #104

Closed mr-shitij closed 3 years ago

mr-shitij commented 3 years ago

According to standards and as used in redis server we always specify latitude first and then longitude. That's why geofilter is not working in redisearch-go client. I Fixed that bug by changing their position and also added an example to demonstrate how to use geofilter filter in redisearch-go client.

I hope you will consider.

codecov[bot] commented 3 years ago

Codecov Report

Merging #104 (61c97c4) into master (75f19ff) will increase coverage by 0.18%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   76.63%   76.81%   +0.18%     
==========================================
  Files          13       13              
  Lines        1100     1100              
==========================================
+ Hits          843      845       +2     
+ Misses        199      198       -1     
+ Partials       58       57       -1     
Impacted Files Coverage Δ
redisearch/client.go 79.78% <0.00%> (+0.54%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 75f19ff...61c97c4. Read the comment docs.

filipecosta90 commented 3 years ago

@mr-shitij GEOFILTER is expressed as long,lat as clearly stated on docs:

GEOFILTER {geo_field} {lon} {lat} {radius} m|km|mi|ft : If set, we filter the results to a given radius from lon and lat. Radius is given as a number and units. See GEORADIUS for more details.

Same applies to the redis GEORADIUS command:

GEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key] [STOREDIST key]

Noneteless I'll fix your example, add another godoc example to make it clear.

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

filipecosta90 commented 3 years ago

@mr-shitij notice I've updated your PR given there was no real bug on the client. I made usage of your example and fixed it. Also included the godoc variant so that people seeing our docs can check It. Thank you for the PR. Merging!

mr-shitij commented 3 years ago

Thank You ..!!