Per
https://cloud.google.com/appengine/docs/python/ndb/queries#repeated_properties
,
myapp.models.UserPhoto.tags.IN(tags)
would be an `OR` query (with its own limits, too), and what you want is
instead an `AND` query; I don't think there's a materially faster way to
compose the latter wrt what you're doing now. Thus, I would indeed
encourage you to explore if the Search API can better match your needs
(within its own limits, such as the 10GB index size constraint).
Alex
On Fri, Mar 13, 2015 at 4:51 PM, Devraj Mukherjee <[email protected]> wrote:
> Hi all,
>
> My application allows users to query via sets of tags (usual arbitrary
> strings), at present I am using a structured property in my model to store
> the set of tags
>
> tags = ndb.StringProperty(repeated=True)
>
> and query it as follows
>
> query =
> meddle.models.UserPhoto.query().filter(meddle.models.UserPhoto.user_key ==
> user_profile.key)
>
> for tag in tags:
> query.filter(myapp.models.UserPhoto.tags == tag)
>
> I suspect ask the stored data grows this might not be the most efficient
> query to run, and have thus been wondering if we should explore the Search
> API to store indexes.
>
> Am mostly looking for a confirmation on if I should go down the path of
> exploring the Search API or is there a better way in NDB to query arbitrary
> strings.
>
> Thanks very much for any pointers.
>
> Dev
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/CANgV5UwQu%3D0cATKeWQF-cNJW1SF_AEEM5s-_UQ%2Brtw%3D9wOM2tA%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-appengine/CANgV5UwQu%3D0cATKeWQF-cNJW1SF_AEEM5s-_UQ%2Brtw%3D9wOM2tA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAE46Be8s3e9X7r8VZJOrBB0mbmVPh-Cj7sy0Zhp2RS3f-1YMSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.