Skip to content

Commit

Permalink
Merged in SHIBUI-997 (pull request #240)
Browse files Browse the repository at this point in the history
SHIBUI-997: wipe out index for each resolver before init/update
  • Loading branch information
dima767 authored and Jonathan Johnson committed Nov 20, 2018
2 parents 9d4d8c3 + 59cd36e commit 5f624be
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@ public Iterable<EntityDescriptor> resolve(@Nullable CriteriaSet criteria) {
}

void addIndexedDescriptorsFromBackingStore(AbstractMetadataResolver.EntityBackingStore backingStore, String resourceId, IndexWriter indexWriter) throws ComponentInitializationException {
for (String entityId : backingStore.getIndexedDescriptors().keySet()) {
Document document = new Document();
document.add(new StringField("id", entityId, Field.Store.YES));
document.add(new TextField("content", entityId, Field.Store.YES)); // TODO: change entityId to be content of entity descriptor block
document.add(new StringField("tag", resourceId, Field.Store.YES));
try {
try {
indexWriter.deleteAll();
for (String entityId : backingStore.getIndexedDescriptors().keySet()) {
Document document = new Document();
document.add(new StringField("id", entityId, Field.Store.YES));
document.add(new TextField("content", entityId, Field.Store.YES)); // TODO: change entityId to be content of entity descriptor block
document.add(new StringField("tag", resourceId, Field.Store.YES));
indexWriter.addDocument(document);
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
try {
indexWriter.commit();
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new ComponentInitializationException(e);
}
}
Expand Down

0 comments on commit 5f624be

Please sign in to comment.