indexing in transactional context

This commit is contained in:
Benjamin Gamard 2018-03-30 14:45:25 +02:00
parent 229d845a42
commit 5c5a3f614f
2 changed files with 4 additions and 4 deletions

View File

@ -38,9 +38,9 @@ public class DocumentCreatedAsyncListener {
contributor.setDocumentId(event.getDocument().getId()); contributor.setDocumentId(event.getDocument().getId());
contributor.setUserId(event.getUserId()); contributor.setUserId(event.getUserId());
contributorDao.create(contributor); contributorDao.create(contributor);
// Update Lucene index
AppContext.getInstance().getIndexingHandler().createDocument(event.getDocument());
}); });
// Update Lucene index
AppContext.getInstance().getIndexingHandler().createDocument(event.getDocument());
} }
} }

View File

@ -36,7 +36,7 @@ public class DocumentUpdatedAsyncListener {
} }
TransactionUtil.handle(() -> { TransactionUtil.handle(() -> {
// Update Lucene index // Update index
DocumentDao documentDao = new DocumentDao(); DocumentDao documentDao = new DocumentDao();
Document document = documentDao.getById(event.getDocumentId()); Document document = documentDao.getById(event.getDocumentId());
if (document == null) { if (document == null) {