To index the properties of existing objects (according to the documentation):
- Get (get) an object from the data store.
- Write (put) the object back to the data warehouse.
didn't work for me. I used the appengine-mapreduce library and wrote MapOnlyMapper<Entity, Void> using the DatastoreMutationPool to index all existing objects in the data store.
Suppose the name property has not been indexed, and I want to index it in all existing entities. I had to do this:
@Override public void map(Entity value) { String property = "name"; Object existingValue = value.getProperty(property); value.setIndexedProperty(property, existingValue); datastoreMutationPool.put(value); }
Essentially, you will need to set the property as an indexed property using setIndexedProperty(prop, value) , and then save (place) the object.
I know that itβs very late to lay out the answer. I thought I could help someone who can deal with this problem.
Amit
source share