On Mon, Jul 27, 2009 at 4:16 PM, Kyle Jensen <[email protected]> wrote:
>
> Hi Nick,
>
> I noticed that the dev server will automatically add indexes that
> appear to be exploding indexes when I run queries like the example
> above. Ie, if I do Foo.get_by_tags(['tag1', 'tag2']) the dev server
> will create an index in index.yaml that is identical to the one you
> posted above:
>
> - kind: Foo
> property: tags
> property: tags
>
> ** Is that index not required for the snippet Foo.get_by_tags(['tag1',
> 'tag2'])?
As long as you're not ordering or filtering on inequality properties, this
index is optional.
>
> ** What about Foo.get_by_tags(['tag1', 'tag2']).order('bar') where bar
> is an IntegerProperty
That would require a custom index.
-Nick Johnson
>
>
> Thanks for your help and sorry for my ignorance!!
> Kyle
>
>
> On Jul 27, 8:07 am, "Nick Johnson (Google)" <[email protected]>
> wrote:
> > Hi Kyle,
> >
> > Exploding indexes only come into play when you're _defining_ indexes -
> for
> > example, an index like this would be an exploding one:
> >
> > - kind: Foo
> > property: tags
> > property: tags
> >
> > As long as you can satisfy your queries using the built in merge join
> > support (which is the case in your example, where you don't specify
> > inequality filters or sort orders), you'll be fine.
> >
> > -Nick Johnson
> >
> >
> >
> > On Mon, Jul 27, 2009 at 3:50 PM, Kyle Jensen <[email protected]> wrote:
> >
> > > Hi, I'd like to know if multiple equality filters on a ListProperty
> > > leads to exploding indexes.
> >
> > > I have a model something like the following (python):
> >
> > > class Foo(db.model):
> > > tags = db.ListProperty(db.Category)
> >
> > > @classmethod
> > > def get_by_tags(cls, tags):
> > > query = cls.all()
> > > for tag in tags:
> > > query.filter('tags =', tag)
> > > return query
> >
> > > I'd like to know if I can filter by an arbitrary number of tags
> > > without encountering the exploding index problem (its not clear to me
> > > from the docs).
> >
> > > E.g., can I do
> > > query = Foo.get_by_tags(['tag0', 'tag1', 'tag2', 'tag3' .... 'tagN'])
> >
> > > etc etc.
> >
> > > Thanks! Kyle
> >
> > --
> > Nick Johnson, Developer Programs Engineer, App Engine
> >
>
--
Nick Johnson, Developer Programs Engineer, App Engine
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---