My advice is to not use queries for search. appengine queries are good for 
set known of specific preset requests. Restaurant search can have too 
variations and to design a query to cater for all possible search options 
would not be the best investment for your time. Instead, use what Appengine 
already has for this usecase: Text Search 
<https://cloud.google.com/appengine/docs/java/search/>
Plus, with this you could cater for partial search as well.

On Sunday, August 16, 2015 at 10:07:15 AM UTC+1, Sanket More wrote:
>
> Hello! I am having so much trouble understanding datastore queries!
> This is my problem.
> I can't seem to figure out whether querying from the top of a tree down to 
> a end node is faster than querying through all end nodes.
> I don't care about write cost or about transactions, I just want to know 
> what would be faster.
>
> Here is an example of what I mean.
> Lets say I have stored all the restaurants in a country through a database 
> hierarchy.
> Level 0 is the world.
> Level 1 are the countries.
> Level 2 are the states.
> Level 3 are the cities
> Level 4 are the restaurants
>
> Now my users want to search for information about a particular restaurant 
> and give me the country state city and restaurant name.
>
> Would it be faster for me to save the country, state, city and restaurant 
> at level 4 and then query through all restaurants for a match? OR
> Would it be faster for me to search the country for all children states, 
> pick the state I want, search the state for cities, pick the city I want, 
> and essentially narrow it down to the restaurant?
>
> Because I feel that with option one, I would end up linearly increasing 
> the time my requests take and that's just not good.
> And with option two, it feels like I would end up having to run multiple 
> queries to find all the children of each level and then pick the child I 
> want. Do I really need to run that many queries?
>
> A perfect solution for me would be one query that allows me to search 
> through the tree and get to the node I want. Is that possible?
>
> Please respond even if I am unclear, I will appreciate literally any help 
> you can give me.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/2f5f4c82-8ea7-485a-9c1a-f6dcf2797beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to