I thought I would post our findings and solution. Our issue seems
slightly different.

We had entities similar to the following:

class Account(db.Model):
  ...

class AccountEntry(db.Model):
  account = db.ReferenceProperty(Account)
  tags = db.StringListProperty()
  utime = db.DateTimeProperty()
    ...

We had the following index in index.yaml, which was generated by
dev_appserver (for another gql query) and deployed to appspot
successfully:


- kind: AccountEntry
  properties:
  - name: account
  - name: tags
  - name: utime
    direction: desc

However, once enough 'AccountEntry' entities where created, the
following gql query:


AccountEntry.gql("WHERE account = :1 AND tags = :2", account,
tag).count(100)

raised the "NeedIndexError: The built-in indices are not efficient
enough for this query and your data. Please add a composite index for
this query." error.

The problem was solved by manually adding the following index to the
index.yaml:


- kind: AccountEntry
  properties:
  - name: account
  - name: tags

since dev_appserver did not automatically generate this index for us
when the above query is executed.

Cheers
Tony


On Jan 9, 3:32 pm, Ryan W <rwilli...@gmail.com> wrote:
> Thanks for the explanation.  I was trying to avoid any
> __search_text_index indexes as you suggest, to get around the 1 per
> each number of keywords, so I didn't use any equality or sorts.  It
> usually works fine, and is again today as far as I can tell.  It
> must've been been something with the particular search query being
> done.  I've tried to set it up to capture/log errors better.
>
> Hopefully the full text solution is on its way soon.
>
> On Jan 9, 10:30 am, ryan <ryanb+appeng...@google.com> wrote:
>
> > hi guys! "merge join" queries like these, ie queries that have equals
> > filters on multiple properties but no inequality filters or sort
> > orders, *usually* don't require an index. that's described 
> > inhttp://code.google.com/appengine/docs/datastore/queriesandindexes.htm...
> > .
>
> > however, in cases with unusually shaped data, these queries can
> > sometimes require an index. these cases are exceedingly rare, but
> > they're somewhat more common with apphosting.ext.search.
>
> > also, you need an index for each number of keywords that you expect in
> > a query. for example, if you support three-word search queries, you
> > need this index:
>
> > - kind: Post
> >   properties:
> >   - name: __searchable_text_index
> >   - name: __searchable_text_index
> >   - name: __searchable_text_index
> >   - name: approved
>
> > more in the ext.search 
> > docstring,http://code.google.com/p/googleappengine/source/browse/trunk/google/a...
> > . also, unfortunately, these kinds of indices are likely to explode,
> > as described 
> > inhttp://code.google.com/appengine/docs/datastore/queriesandindexes.htm...
> > .
>
> > the upshot of all of this, as we've mentioned before, is that
> > appengine.ext.search is a hack. it's not scalable, mature, or anywhere
> > near industrial strength, which is why it's not officially supported
> > or documented. we're well aware that it's not good enough, and we
> > dearly hope to offer a real full text search solution in the future. i
> > don't have any details or timeline, though.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to