GeoDistanceQuery with additional clauses

Hi there
I’m fairly new to Couchbase and I’m trying to understand if it possible to issue a GeoDistanceQuery (via .net sdk) with additional where clauses? For example search all the items within 10 mile radius that also say have at least 2 bedrooms or any other extra clause. It seems like one can either go down the n1ql route and not use geospatial index and use raidans and calcualte min/max lat/lon for a bounding box and be able to add extra where clauses there.

Hi @metase,

You have a few options here. I would recommend first trying a compound FTS query (which is a combination of multiple FTS queries). So you could, for instance, create a conjunction query between a geospatial query and a range query, etc.

That should probably work for you, but if that’s not adequate, you can also “combine” an FTS query and N1QL query within your client. FTS queries return document keys, which you can then feed into a N1QL query.

You might also want to asking in the FTS forum instead of the .NET forum.

Hi @matthew.groves thanks for that. I need to try compound query again I mistakenly combined FTS and a normal index and it sadly didn’t work and I didn’t realise that the index on another query had to be a FTS index too.
Out of interest how do you feed list of DocIDs into N1QL query? is it just a simple IN statement?

There is a USE KEYS clause you can use:

UPDATE `travel-sample` USE KEYS \"cust_2\

or

  DELETE FROM `travel-sample` USE KEYS \"cust_50\"

or

SELECT * FROM myBucket USE KEYS '234567'

etc.

2 Likes