Reputation: 1001
I am using AppEngine's native Datastore API to store objects in Java.
I have a requirement to search on various items in an object - eg: email address, subject of email, from name etc. It should show the results even for partial input - like real-time searches.
To achieve that, I am tokenizing the items into possible inputs into fragments using StringUtils2.breakdownFragments - the string "Foo Bar" would become: "f", "fo", "foo", "b", "ba", "bar"
What I do not understand is how can I give this list of Strings to be indexed and how can I retrieve them back applying filters?
While using JDO or Objectify, I see it to relatively straight forward but using it via the native API, I do not how to do it.
Entity does not take a list to be stored.
Can it even be done?
Upvotes: 0
Views: 541
Reputation: 426
Beware of exploding indexes. Each list property item gets indexed separately. You will be very limited in the complexity of the queries you can run. I went that road before the advent of the Search API.
If your search feature can tolerate being out of sync for small amount of times, I would suggest using the Search API to implement your feature.
Upvotes: 0
Reputation: 13556
You can call Entity.setProperty()
and pass a List<String>
as the value.
Upvotes: 0