Add a new field called, e.g, queryableStatus that is a list of strings. 
Then pre-compute your query logic so that you only need an equality filter.

E.g, when saving the entity (warning: pseudocode ahead):

  if status in ['PAID', 'PARTIALLY_PAID']:
    invoice.queryableStatus.append('PAID_OR_PARTIALLY_PAID')
  # you can have all sorts of logic combinations and tags appended, if you 
need them
  invoice.save()


Then. when you query, you can use an equality:

  ofy.query(Invoice.class).filter("status =", 
['PAID_OR_PARTIALLY_PAID']).limit(100).list()


This will let the cursor work as expected.


Of course, you'll have to one-time update all your existing invoices. And 
you'll need to one-time update all your existing invoices whenever your 
QueryableStatus logic changes.



On Tuesday, 17 January 2017 20:38:53 UTC-8, Rajesh Gupta wrote:
>
> I have the following 
>
> Public class Invoice {
>   @Id Long id
>    Key<Party> partyKey;
>    Status status
> }
>
> enum Status {
>   PAID, PARTIAL_PAID, PENDING, DRAFT
> }
>
> I want to find all invoices with Status = PAID, PARTIAL_PAID, so I do the 
> IN query
>
> ofy.query(Invoice.class).filter("status in", [PAID, 
> PARTIAL_PAID]).limit(100).list()
>
> However, then, if I want the next 100, the cursor will not work because of 
> IN query
>
> What are the alternate solutions or schemas'.
>
> -- 
> Regards,
> Rajesh
> *www.VeersoftSolutions.com <http://www.VeersoftSolutions.com>*
> *www.GainERP.com <https://www.gainerp.com>*
> *Accounting/Inventory/Orders/Sales/Purchase on Google Cloud Platform and 
> Mobile*
>
>

-- 
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 https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/c194cda0-2fdb-4f2e-8b11-1b641cd7de82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to