How can I combine normal query with a geoquery

0 votes
I want to create a composite query that will consist of a normal query and a geoquery. Can I just say

Query q3 = QueryBuilder.compositeOperator(q1, Operator.AND, q2)

where q1 is a normal query and

q2 is a geoQuery?
asked Oct 12, 2014 in App42 Cloud API-BaaS by jamesagada (20 points)

1 Answer

0 votes

Hello James,

There is no such method in which you can create a composite query for finding the data. Either you can make a query for geo specific or non geo specific and cannot mix both. You have to write two different query on Storage to find the data. Please let us know the use case so that we can suggest a better way to implement this in your app.

Himanshu Sharma

 

answered Oct 13, 2014 by hs00105 (2,005 points)
edited Nov 19, 2014 by hs00105
I have a collection of documents that are geotagged. I want to be able to retrieve the documents containing a particular key and  that are within a fixed distance from a reference location.
I have a collection of documents that are geotagged. For instance, records of accidents that are geotagged. I want to be able to select the accidents that happened on a certain day within a 10kilometres of a given point.
Hello James,
 
Its not possible to combine both query to find your document from Storage.
Ideal way is to apply one filter using API and do client side filtering for next level.
Also,  you can write custom code to combine the result for the same if you want to do it server side. You can find the json document first from storage service and then can filter the records further based on your key value criteria. You can flush back those filtered record to the client which will have target JSON docs based on your need. Please have a look on the below link and let us know if it helps.
 
http://api.shephertz.com/tutorial/Server-Side-Custom-Code/?index=customcode-wrd
 
Thanks,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...