Subhash,
Here's a clip from the relevant portion of the Docs regarding index
order:

An index table contains columns for every property used in a filter or
sort order. The rows are sorted by the following aspects, in order:

    * ancestors
    * property values used in equality filters
    * property values used in inequality filters
    * property values used in sort orders

This puts all results for every possible query that uses this index in
consecutive rows in the table.

This is from 
http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Introducing_Indexes

Stephen

On Aug 2, 9:39 am, Stephen Johnson <[email protected]> wrote:
> Sorry,
>   I meant:
>
> Thus you need an INDEX ordered by name then age because the equality
> COLUMNS need to proceed the inequality COLUMNS in the index. (Didn't
> have my coffee yet). So, my guess would be that
> your second query:
>
> On Aug 2, 9:37 am, Stephen Johnson <[email protected]> wrote:
>
> > Hi Subhash,
> > The first query gets translated into two queries:
>
> >   Select * From User Where userName = 'sachin' And age < '20'
> >     and
> >  Select * From User Where userName = 'sachin' And age > '20'
>
> > Thus you need a query ordered by name then age because the equality
> > filters need to proceed the inequality. So, my guess would be that
> > your second query:
>
> >    Select * From User Where userName = 'sachin' And age = '20'
>
> >  works because you have an index ordered by age then name which would
> > work since your query filters are both equality filters and thus order
> > in the index is not important.
>
> > Hope this helps,
> > Stephen
>
> > On Aug 2, 12:12 am, Subhash <[email protected]> wrote:
>
> > > Hi All,
>
> > > When I am running any GQL with using 'Not Equal To' and 'And' operator
> > > both the Google App Engine gives the error no matching index found.
>
> > > For example:
> > > Select * From User Where userName = 'sachin' And age != '20'
> > > error
> > > no matching index found.
>
> > > This query needs this index:
> > > - kind: User
> > >   properties:
> > >   - name: userName
> > >   - name: age
>
> > > But when I run following GQL then it works properly.
> > > Select * From User Where userName = 'sachin' And age = '20'
>
> > > Any suggestion/help are appreciated.
>
> > > Thanks in advance.
>
> > > Subhash

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" 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-java?hl=en.

Reply via email to