MultiplexingIndexWriter implements LuceneIndexWriter { @Override public boolean close(long timestamp) throws IOException { stream(concat(singleton(mountInfoProvider.getDefaultMount()), mountInfoProvider.getNonDefaultMounts()) .spliterator(), false) .filter(m -> reindex && !m.isReadOnly()) .forEach(m -> getWriter(m)); boolean indexUpdated = false; for (LuceneIndexWriter w : writers.values()) { indexUpdated |= w.close(timestamp); } return indexUpdated; } MultiplexingIndexWriter(DirectoryFactory directoryFactory, MountInfoProvider mountInfoProvider,
                                   LuceneIndexDefinition definition, NodeBuilder definitionBuilder,
                                   boolean reindex, LuceneIndexWriterConfig writerConfig); @Override void updateDocument(String path, Iterable<? extends IndexableField> doc); @Override void deleteDocuments(String path); @Override boolean close(long timestamp);  }
@Test public void closeWithoutChange() throws Exception{ LuceneIndexWriterFactory factory = newDirectoryFactory(); LuceneIndexWriter writer = factory.newInstance(defn, builder, null, true); assertTrue(writer.close(0)); assertEquals(2, Iterables.size(getIndexDirNodes())); assertFalse(builder.hasChildNode(indexDirName(roMount))); assertEquals(0, numDocs(fooMount)); assertEquals(0, numDocs(defaultMount)); getIndexDirNodes().forEach(dirName -> builder.getChildNode(dirName).remove()); writer = factory.newInstance(defn, builder, null, false); assertFalse(writer.close(0)); assertEquals(0, Iterables.size(getIndexDirNodes())); }