Open jpiulac opened 8 years ago
Hi,
I'll keep this issue open until the documentation is improved, but for the mean time - read EVAL
's documentation to learn how scripts should be called.
Specifically, note the need for specifying the number of keys (1) and the clear separation between key names (Sicily
in your example) and the arguments (e.g. GEOBEARING
, Catania
and Palermo
). Because order matters, you put the key names before the arguments.
This means that, despite being less intuitive, using the library is as follows:
EVALSHA fd07... 1 Sicily GEOBEARING Catania Palermo
EVALSHA fd07... 1 Sicily GEODEL Catania
OK got it working now, many thanks!
I'm trying to use 2D geometries and polygon search. I don't understand this GEOMETRYADD KEYS[1] geomash ARGV[2] geometry-type 3] id 4..].
I tried this to create a polygon.
$ redis-cli EVALSHA fd07... 1 Sic GEOMETRYADD polygon -0.088153 51.505665, -0.08954 51.505478, -0.090567 51.505519, -0.0906 51.5038
I am getting this error.
@user_script:395: user_script:395: Expecting at least 4 coordinates
I want to create a polygon and verify whether a given point is inside it or not. Please help me we an example.
@nitin099 it looks that you're missing an id
parameter.
This one worked for me:
$ redis-cli EVALSHA fd07... 1 area-01 GEOMETRYADD polygon id-01 -0.088153, 51.505665, -0.08954, 51.505478, -0.090567, 51.505519, -0.0906, 51.5038, -0.088153, 51.505665
Also according to the documentation first and last polygon vertices should be equal.
Further filtering:
$ redis-cli EVALSHA fd07... 2 locations area-01 GEOMETRYFILTER WITHCOORD id-01
locations
- name of the geoset, which is verified to be inside a polygon.
area-01
- geomash name, used in GEOMETRYADD
.
id-01
- polygon ID, created via GEOMETRYADD
.
I'm not very familiar with calling Lua scripts in Redis and had trouble getting commands to work. An easy to follow example might help:
redis> GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"
The calls I tried below gave me errors. I'm not sure what i'm doing wrong and I tried various combinations but no luck.