GAE already includes a left-like operator (property LIKE 'foo%'). I
don't know how to use it with JDO though, but it should be in the
Reference Guide.

For a full LIKE operator (LIKE '%foo%') there is a recent entry in the
AppEngine blog:
http://googleappengine.blogspot.com/2010/04/making-your-app-searchable-using-self.html

Hope  this helps.

On Jun 11, 7:12 pm, RAVINDER MAAN <[email protected]> wrote:
> thanks john
>    any thought for like operator of sql.how can we implement like operator
> of sql in GAE
>
> On Fri, Jun 11, 2010 at 8:49 PM, John Patterson <[email protected]>wrote:
>
>
>
>
>
> > The best you could probably do is load into memory a structure that keeps
> > the employee type for every employee.  When the user types some letters of a
> > name to search for you can perform a keys-only query and lookup the employee
> > type in this structure (rather than load the entity)
>
> > You would need 2 bits per employee (for 4 types) so even a million
> > employees would only require 250KB of memory (an array of 30K longs) which
> > shouldn't take too long to read from memcache when an instance starts.
>
> > You would then need to iterate over every result and count which type the
> > employee is.  To optimise this you might cache the counts in memcache of 1
> > and 2 letter searches.  So then you would only need to count on the fly
> > three letter searches i.e. all employees with names starting with "smi"
>
> > On 11 Jun 2010, at 20:53, RAVINDER MAAN wrote:
>
> > number of employee entities is going to be high .So i guess that
> > possibility of getting more then 1000 employees for any search is quite
> > high.
>
> > On Fri, Jun 11, 2010 at 6:56 PM, John Patterson 
> > <[email protected]>wrote:
>
> >> A lot depends on how many Employee entities you have.
>
> >> You could do a sub search for each of the 4 employee types and use COUNT
> >> to get the results.  This will only work up to 1000 employees per employee
> >> type.
>
> >> Twig can execute queries in parallel so this would take no more time than
> >> running your original query.
>
> >> On 11 Jun 2010, at 19:39, RAVINDER MAAN wrote:
>
> >> Thanks for your reply Ravi
> >>    let me explain the entire scenario.I have an employee entity .User can
> >> search employees by giving part of name .There are four type of employees 
> >> .I
> >> have to show number of employees matching user search criteria for every
> >> type of employee under different tabs.Actual results are to be displayed
> >> only if user open that tab.
> >> In SQL term we could write following query
>
> >> Select count(*) from employee where name like '%<searchname>%' and type
> >> ='A' ;
>
> >> My first problem is that i dint find any equivalent of like operator.Is
> >> there any way to do it?
> >> Secondly we can not keep record count for each search combination.what
> >> will you suggest for this case?
> >> Thanks once again.
>
> >> On Fri, Jun 11, 2010 at 4:23 PM, Ravi <[email protected]> wrote:
>
> >>> Google app engine designed to work for any numbers of records with in
> >>> minimum time, so SQL features like counting the records whenever
> >>> needed is not supported.
> >>> So you need to take care of such counter by urself at the time of
> >>> adding or deleting the records in a table/entity.
>
> >>> If you just want total number of records and dont care if counting
> >>> happened in last 24 hours then look into low level api for datastore
> >>> statistics, GAE refreshes total count every 24 hours and you can read
> >>> the total count from there.
>
> >>> And if you want count of records with some where clause, then you need
> >>> to maintain it.
>
> >>> like if u want like this
> >>> select count(0) from tb where tb.propA='someValue'
>
> >>> then you may need to create a new entity say counterForTb, and have
> >>> few fields entityName and count and where clause columns
> >>> and whenevr you add a new record in tb then increase the count of that
> >>> record in counter table and on delete decrease it.
>
> >>> Something for google guys
> >>> Just realized that all columns are indexed unless we specify to not to
> >>> index, and there must be some index meta data/statistics saved
> >>> somewhere in google data stores about index(like total records
> >>> matching to this index). And if that stats can be accessible through
> >>> some APIs then we may be able to get total count just by reading data
> >>> from indexes stats.
> >>> Is this something feasible?
>
> >>> On Jun 11, 11:39 am, RAVINDER MAAN <[email protected]> wrote:
> >>> > How can we get records count for a query in JDO.
> >>> > In sql we have select count(*) from <table_name>
> >>> > i want to get number of records returned by a query. what is the
> >>> > efficient way to do that.One option is to use size() function .I think
> >>> > it is not best way.
>
> >>> --
> >>> 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]<google-appengine-java%2B
> >>>  [email protected]>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-appengine-java?hl=en.
>
> >> --
> >> Regards,
> >> Ravinder Singh Maan
>
> >> --
> >> 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.
>
> >> --
> >> 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]<google-appengine-java%2B
> >>  [email protected]>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > Regards,
> > Ravinder Singh Maan
>
> > --
> > 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.
>
> >  --
> > 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]<google-appengine-java%2B 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Regards,
> Ravinder Singh Maan

-- 
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