diff --git a/CHANGELOG.md b/CHANGELOG.md index 406731c577..ca5b54ee4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -143,6 +143,9 @@ Current ### Fixed: +- [Fix lucene search provider replace method](https://github.com/yahoo/fili/pull/551) + * Reopen the search index + - [Fix ConstantMaker make method with LogicalMetricInfo class](https://github.com/yahoo/fili/pull/540) * The ConstantMaker make method needs to be rewritten with the LogicalMetricInfo class. diff --git a/fili-core/src/main/java/com/yahoo/bard/webservice/data/dimension/impl/LuceneSearchProvider.java b/fili-core/src/main/java/com/yahoo/bard/webservice/data/dimension/impl/LuceneSearchProvider.java index 601dbfb598..bcaa71697e 100644 --- a/fili-core/src/main/java/com/yahoo/bard/webservice/data/dimension/impl/LuceneSearchProvider.java +++ b/fili-core/src/main/java/com/yahoo/bard/webservice/data/dimension/impl/LuceneSearchProvider.java @@ -327,25 +327,34 @@ private void updateDimensionRow( @Override public void replaceIndex(String newLuceneIndexPathString) { + LOG.debug( + "Replacing Lucene indexes at {} for dimension {} with new index at {}", + luceneDirectory.toString(), + dimension.getApiName(), + newLuceneIndexPathString + ); + lock.writeLock().lock(); try { Path oldLuceneIndexPath = Paths.get(luceneIndexPath); String tempDir = oldLuceneIndexPath.resolveSibling(oldLuceneIndexPath.getFileName() + "_old").toString(); - LOG.debug("Moving old Lucene index directory from {} to {} ...", luceneIndexPath, tempDir); + LOG.trace("Moving old Lucene index directory from {} to {} ...", luceneIndexPath, tempDir); moveDirEntries(luceneIndexPath, tempDir); - LOG.debug("Moving all new Lucene indexes from {} to {} ...", newLuceneIndexPathString, luceneIndexPath); + LOG.trace("Moving all new Lucene indexes from {} to {} ...", newLuceneIndexPathString, luceneIndexPath); moveDirEntries(newLuceneIndexPathString, luceneIndexPath); - LOG.debug( + LOG.trace( "Deleting {} since new Lucene indexes have been moved away from there and is now empty", newLuceneIndexPathString ); deleteDir(newLuceneIndexPathString); - LOG.debug("Deleting old Lucene indexes in {} ...", tempDir); + LOG.trace("Deleting old Lucene indexes in {} ...", tempDir); deleteDir(tempDir); + + reopenIndexSearcher(false); } finally { lock.writeLock().unlock(); }