Ok, _now_ I remember how I did this...

This work-around will only be practical if your result set is
relatively small (mine were less than 500 entities but maybe you could
get away with more)

You perform two separate queries that match both values for 'a'.  Be
sure to use the "keys_only=True" in your query.  Then you need to loop
through the results, eliminate the duplicates and store the keys in a
list.  At that point simply do a batch get of the keylist:

final_results = db.get(list_of_keys)

Sorry about the previous post.


On Nov 24, 10:27 am, Joseph Letness <[email protected]> wrote:
> If 'a' is not a ListProperty you will never get a matching result for
> "a=x AND a=y".  What is sounds like is that you want something like
> this "b=z AND c=t AND(a=x OR a=y)". Unfortunately, AFAIK, this will
> not work with current implementation of the datastore due to the query
> generating an exploding index (although, I think this will be covered
> as part of the "Next-Gen Queries" when they are rolled out).
>
> A work-around would be to de-normalize the 'a' property in your
> model :
>
> create two distinct properties to represent the value 'a' as 'a' and
> 'ab' and populate both with the same value. Then your query would be
> "a=x AND ab=y AND b=z AND c=t" which shouldn't need an custom index.
>
> You will incur the overhead of storing the extra property.
>
> On Nov 7, 1:13 am, ZS <[email protected]> wrote:
>
>
>
> > I have a query like
> > a=x AND a=y AND b=z AND c=t
> > and it is failing saying there is no suitable index. I thought all
> > equalities is always allowed? Does that not apply if there are two
> > equalities on the same property? Yet a=x AND a=y AND b=z  works ok so
> > what is the rule?
>
> > Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to