That's a similar approach to the SearchableModel class included with the Python SDK. There are other ways of making your datastore searchable in Java. One example: http://www.kimchy.org/searchable-google-appengine-with-compass/
- Jason On Sun, Aug 16, 2009 at 11:18 AM, Kris <[email protected]> wrote: > > Hi Jeff, > > Thanks for the reply. I did what you suggested and the lowercase > solution works nicely so the I can do case insensitive searches. With > regard to the wild-card search I did not find a perfect solution. What > I have done is to split up the String, that I wish to search in, into > words and stored them in an ArrayList all in lowercase. Now I can use > the contains method on the ArrayList. This way I can get a word match > search which is good enough for my needs. > > The best regards > Kris > > > > On 16 Aug., 16:05, Sean Lynch <[email protected]> wrote: > > Hey Anton - I've seen a few people run into this before. > > > > .contains(...) in this case only works on List fields in your model. > > So the query you're trying to run is actually checking to see if any > > of the items in that list is exactly "A". This is why it's treated > > the same as ==. contains(...) does _not_ work on a single string > > object to do substring matching like you're trying to do. > > > > Out of curiosity, what are you trying to match a substring for? > > > > On Aug 15, 7:20 am, Anton Ananich <[email protected]> wrote: > > > > > Hi. > > > > > I have just found an answer in the source code myself. It seems that > > > contains(...) works like operator ==. Is this a bug? > http://code.google.com/p/datanucleus-appengine/source/browse/trunk/sr... > > > > > Best regards, > > > Anton Ananich > > > > > On Aug 15, 4:58 pm, Anton Ananich <[email protected]> wrote: > > > > > > Dear Jeff, > > > > > > I have just spend several hours trying to make [field].contains(...) > > > > working, however I was not able to do that. > > > > Here is piece of code: > > > > > > Query q = PMF.getInstance().newQuery(my.package.Customer.class); > > > > q.setFilter("address.contains(\"A\")"); > > > > q.setResult("count(this)"); > > > > o = q.execute().toString(); > > > > > > I tried out different combinations, but always got zero. Than I tried > > > > to use startsWith instead of contains and it works as needed. > > > > Could you please give me a hint what is the best way to find all the > > > > customers from "Roma" using google apps engine? > > > > > > Best Regards, > > > > Anton Ananich > > > > > > On Aug 7, 3:42 am, "Jeff S (Google)" <[email protected]> wrote: > > > > > > > Hi Kris, > > > > > > > You can currently use startsWith, contains, and regular expressions > as long > > > > > as the pattens is a startsWith type of query (ex: blah.* but not > .*blah). I > > > > > don't think endsWith will work. If you want to create case > insensitive > > > > > search, it might be helpful to store a lowercased form of the text > in your > > > > > entity along with the original text content. > > > > > > > Thank you, > > > > > > > Jeff > > > > > > > On Wed, Aug 5, 2009 at 5:50 AM, Kris <[email protected]> wrote: > > > > > > > > Hi all, > > > > > > > > I just started to work with the Google App Engine and I have run > into > > > > > > some troubles on finding query syntax documentation. What I am > trying > > > > > > to figure out is how I can build up my where conditions. > > > > > > > > Ex. > > > > > > I can write: "select from " + [myClass].class.getName() + " where > > > > > > [myField].startsWith(\"Hello\")"; and this works fine. I can use > > > > > > endsWith as well but I can not use substring, toLowerCase or > indexOf. > > > > > > > > What else can I put into my where clause? > > > > > > > > What I am trying to achieve is some kind of wildcard or case > > > > > > insensitive query search. > > > > > > > > The best regards > > > > > > Kris > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
