I am trying to work my way thru the not so well documented world of Geo Search and how to combine them with N1QL.
I found a few samples that show N1QL/FTS integration using N1QL SEARCH predicate but none shows how to do that with a Geo based search. I am looking for more info on the syntax if i want to specify a location and a radius as well as sort by distance. Also if i do a basic FTS search like this via curl i specify a from and size which is like offset and limit, will that supersede the N!QL limits or offsets ?
Here is my FTS query that works via curl
{
"from": 0,
"size": 100,
"query": {
"location": {
"lon": -115.6887945,
"lat": 37.516891
},
"distance": "2mi",
"field": "geo"
},
"sort": [
{
"by": "geo_distance",
"field": "geo",
"unit": "mi",
"location": {
"lon": -115.6887945,
"lat": 37.516891
}
}
]
}'
And this is what i tried for N1QL query with no luck
SELECT META(a).id,
a._type,
a.Address
FROM rets a
WHERE a._type='Residential'
AND SEARCH(a, {"conjuncts": [ { "location": { "lon": -115.6887945, "lat": 37.516891 }, "distance": "2mi", "field": "geo" } ] }, {"index":"Geo_Index"})