Redisearch: Correct way to use GEO/GEOFILTER?

Created on 19 Mar 2017  路  8Comments  路  Source: RediSearch/RediSearch

This is a pretty basic example I put together based on the docs, but these commands yield zero search results...

FT.CREATE GeoTest SCHEMA name TEXT place GEO
FT.ADD GeoTest 158ce9ce941bce 1 FIELDS name Foo place Washington D.C. -77.0366 38.8977
FT.SEARCH GeoTest Foo GEOFILTER place -77.0366 38.8977 1 km

These are the keys the commands create...

1) "ft:GeoTest/foo"
2) "idx:GeoTest"
3) "158ce9ce941bce"

There should probably be a key called something like "geo:GeoTest/place", correct?

All 8 comments

I think there's a problem in the way you are inserting - first of all, place can only be lon,lat. Second you need to quote multi word expressions. So it should be:

FT.ADD GeoTest 158ce9ce941bce 1 FIELDS name "Foo" place "-77.0366 38.8977"

If you want the place name add it in a different field.

That makes much more sense. Thanks!

@ethan-tr what language are you working with? Both Python and Java have clients that encapsulate those things for you.

I am putting together a PHP client - https://github.com/ethanhann/redisearch-php

Wow! looks awesome, very nice API! I'm very happy to see this. Mind if I share it?

Thanks. I feel like it it is coming together nicely. Feel free to share.

@ethan-tr totally awesome + double points for the documentation :100:

this is great

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanhann picture ethanhann  路  6Comments

yansuihehe picture yansuihehe  路  5Comments

tw-bert picture tw-bert  路  4Comments

mahemoff picture mahemoff  路  4Comments

onexdrk picture onexdrk  路  6Comments