Another way I can think of divide the kind and do some form of keys
only query on ItemIndex and transform them to parent keys (http://
www.youtube.com/watch?v=AgaL6NGpkB8) and then filter in memory as per
invoiceDate? But this way I may end fetching lots of invoices which do
not meet criteria, any  suggestions?

class Invoice
{
        @Id Long id;
        Date invoiceDate;
        Long invoiceNo;
}

class ItemIndex
{
        @Id Long id;
        @Parent Key<Invoice> invoice;
        List<String> items;
}

On Jul 12, 7:21 am, Parvez <parvez.chau...@gmail.com> wrote:
> Thanks Robert.
> I don’t think that will solve it.
> I think text search could have solved it easily, which is not in at
> the moment, unfortunately.
>
> If I design it something like this (Item as concatenated strings of
> items separated by a space):
>
> InvoiceNo          Item                         InvoiceDate
>
> 10                      item_a
> 11                      item_a item_b item_z
> 12                      item_a item_c item_x
> 13              item_a item_x
>
> I am not sure how text search will work or going to look like when in,
> but just say may be something like this
>
> SELECT * FROM  Invoice WHERE item CONTAINS(“item_a”, “item_b”) AND
> InvoiceDate >= someDate AND  InvoiceDate < someOtherDate
>
> I implemented search as suggested in various posts/blog, but that is
> not working as I have a range scan as well and due to that GAE always
> put range scan in the end and that result in lots of indexes.
>
> e.g.
> If I have one item to search in invoice then it will need following
> index (even in query if I put date filter first, then still it will
> put date scan in end, as range is last, otherwise I could get away
> with one large index)
>
>     <datastore-index kind="Invoice" ancestor="false">
>         <property name="Item" direction="asc"/>
>         <property name="InvoiceDate" direction="asc"/>
>     </datastore-index>
>
> If I have 2 items to search then it needs
>
>     <datastore-index kind="Invoice" ancestor="false">
>         <property name="Item" direction="asc"/>
>        <property name="Item" direction="asc"/>
>         <property name="InvoiceDate" direction="asc"/>
>     </datastore-index>
>
> and so on.
>
> Any thoughts/suggestions?
>
> On Jul 11, 1:55 pm, Robert Lancer <robert.lan...@gmail.com> wrote:
>
> > I dont fully understand the problem, but you might want to look into
> > using the IN filter option that can take a list of items and return
> > the associated entities, if the list is small enough you can cook up
> > the set operations in memory.
>
> > On Jul 11, 6:58 am, Parvez <parvez.chau...@gmail.com> wrote:
>
> > > I want retrieve invoice numbers depending upon items e.g.
>
> > > InvoiceNo        Item          InvoiceDate
>
> > > 10      item_a
> > > 11      item_a
> > > 11      item_b
> > > 11      item_z
> > > 12      item_a
> > > 12      item_c
> > > 12      item_x
> > > 13      item_a
> > > 13      item_x
>
> > > User can search on item(s) and can also include period (invoice date)
> > > as part of search.
> > > Initially, I tried using list property for Item, it worked but then it
> > > failed once more than 6, 7 items included in query along with date
> > > i.e. "Too many indexed properties for entity.." [:-) then I found out
> > > that I can not delete index in java, using java sdk 1.3.5, it works
> > > locally, but does not work when application uploaded]
>
> > > In above example if user query for "item_a" and  "item_b" then I
> > > should only get invoice number 11.
> > > Any suggestion how can I achieve this?
> > > Thanks.

-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to