Max implemented a LIKE operator for JPA (and JDO too, if I recall) that does exactly this under the covers -- no extra fiddling with the strings needed. It's been there for at least four months now, and is also a prefix-only search; the clause is:
Neat! You're right "starts with" is probably enough for names and tags. Must try this immediately. For when starts-with ain't enough you can try the "like-ish" search technique that I posted about in /r/AppEngine: Simple like-ish serach.
Thanks for posting. Having experimented with this myself and various other techniques, I am somewhat disappointed and honestly expected a lot more from Google in this regard since were talking search here.. When will full text search for the datastore be available so we don't have to use these other techniques that are cumbersome and don't quite accomplish searches the way I have wanted to in the end.... Thank you in advance for any info you can provide.
I tried this technique and it does work to find the entities. But now the problem is, I cannot sort the results, even though the indexes are created for the sorting. Were you able to do this?
Great!
ReplyDeleteThis is just what I've been looking out for.
I'll try it asap.
Max implemented a LIKE operator for JPA (and JDO too, if I recall) that does exactly this under the covers -- no extra fiddling with the strings needed. It's been there for at least four months now, and is also a prefix-only search; the clause is:
ReplyDeleteLIKE 'foobar%'
where the % must be at the end of the string.
Neat! You're right "starts with" is probably enough for names and tags. Must try this immediately. For when starts-with ain't enough you can try the "like-ish" search technique that I posted about in /r/AppEngine: Simple like-ish serach.
ReplyDeleteThanks for posting. Having experimented with this myself and various other techniques, I am somewhat disappointed and honestly expected a lot more from Google in this regard since were talking search here.. When will full text search for the datastore be available so we don't have to use these other techniques that are cumbersome and don't quite accomplish searches the way I have wanted to in the end.... Thank you in advance for any info you can provide.
ReplyDeleteI tried this technique and it does work to find the entities. But now the problem is, I cannot sort the results, even though the indexes are created for the sorting. Were you able to do this?
ReplyDelete@Jim I totally agree. The search giant of the world does not implement a basic full-text search feature! That much irony is painful
ReplyDeleteI used it and it worked well, but it is case sensitive, which is a bit inefficient. Any ideas to make it NOT case sensitive?!
ReplyDeletequery.setOrdering("other");
ReplyDeleteAfter I added the code, the exception is thrown:
The first sort property must be the same as the property to which the inequality filter is applied.
please help me