Hi all,
Been testing out the new Search API. Since we already have data on the system I've written a several commands, each to refresh the search indexes for given searchable objects.
It works fine on the the development platform, but doesn't index any instances when deployed to GAE {shows no Search Stored Data in the dashboard and doesn't perform search as intended on the data).
I know search is currently beta, but I want to make sure this issue is not on my side.
Please find below a simplified version of the code I am using (for the sake of simplicity I've removed some of the fields I am indexing)
Thanks in advance for any help
----------------------------------------------------------------------------------------------
....
Builder builder = Document.newBuilder().setId("" + collection.getId());
builder.addField(Field.newBuilder()
.setName(MediaCollectionDAO.INDEXED_FIELD_NAME)
.setText(collection.getName()));
Document profileDoc = builder.build();
addToIndex(profileDoc, collection.getId(), 0);
....
public void addToIndex(Document profileDoc, Long collectionId, int i) {
try {
// Add the document.
getIndex().add(profileDoc);
} catch (AddException e) {
if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult()
.getCode())) {
if (i < MAX_RETRIES) {
addToIndex(profileDoc, collectionId, i++);
} else {
logger.warning("Unable to index collection " + collectionId
+ " in search");
}
}
}
}