public void updateDocuments( Term identifierTerm, DocumentsModifier documentsModifier, Analyzer analyzer) { LuceneIndexReader reader = IndexReaderFactoryUtils.getIndexReader(indexFactory); LuceneSearcher searcher = reader.createSearcher(); List updatedDocuments = null; try { LuceneHits hits = searcher.search(new TermQuery(identifierTerm)); updatedDocuments = documentsModifier.updateDocuments(hits); } catch (Exception ex) { throw new LuceneIndexAccessException("Error during updating a document.", ex); } finally { SearcherFactoryUtils.closeSearcher(searcher); IndexReaderFactoryUtils.releaseIndexReader(indexFactory, reader); } deleteDocuments(identifierTerm); addDocuments(updatedDocuments, analyzer); }