@Test public void indexDirWithBlobStore() throws Exception { CachingFileDataStore ds = DataStoreUtils .createCachingFDS(folder.newFolder().getAbsolutePath(), folder.newFolder().getAbsolutePath()); DirectoryFactory directoryFactory = new DefaultDirectoryFactory(null, new DataStoreBlobStore(ds)); LuceneIndexWriterFactory factory = new DefaultIndexWriterFactory(mip, directoryFactory, writerConfig); LuceneIndexWriter writer = factory.newInstance(defn, builder, null, true); writer.updateDocument("/content/en", newDoc("/content/en")); writer.close(0); LuceneIndexReaderFactory readerFactory = new DefaultIndexReaderFactory(mip, null); List<LuceneIndexReader> readers = readerFactory.createReaders(defn, builder.getNodeState(),"/foo"); assertEquals(1, readers.size()); LuceneIndexReader reader = readers.get(0); assertNotNull(reader.getReader()); assertNull(reader.getSuggestDirectory()); assertNull(reader.getLookup()); assertEquals(1, reader.getReader().numDocs()); final AtomicBoolean closed = new AtomicBoolean(); reader.getReader().addReaderClosedListener(reader1 -> closed.set(true)); reader.close(); assertTrue(closed.get()); }
@Override public List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState, String indexPath) throws IOException { if (!mountInfoProvider.hasNonDefaultMounts()) { LuceneIndexReader reader = createReader(definition, defnState, indexPath, FulltextIndexConstants.INDEX_DATA_CHILD_NAME, SUGGEST_DATA_CHILD_NAME); return reader != null ? ImmutableList.of(reader) : Collections.<LuceneIndexReader>emptyList(); } else { return createMountedReaders(definition, defnState, indexPath); } }
DefaultIndexReaderFactory implements LuceneIndexReaderFactory { @Override public List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState, String indexPath) throws IOException { if (!mountInfoProvider.hasNonDefaultMounts()) { LuceneIndexReader reader = createReader(definition, defnState, indexPath, FulltextIndexConstants.INDEX_DATA_CHILD_NAME, SUGGEST_DATA_CHILD_NAME); return reader != null ? ImmutableList.of(reader) : Collections.<LuceneIndexReader>emptyList(); } else { return createMountedReaders(definition, defnState, indexPath); } } }
DefaultIndexReaderFactory implements LuceneIndexReaderFactory { @Override public List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState, String indexPath) throws IOException { if (!mountInfoProvider.hasNonDefaultMounts()) { LuceneIndexReader reader = createReader(definition, defnState, indexPath, FulltextIndexConstants.INDEX_DATA_CHILD_NAME, SUGGEST_DATA_CHILD_NAME); return reader != null ? ImmutableList.of(reader) : Collections.<LuceneIndexReader>emptyList(); } else { return createMountedReaders(definition, defnState, indexPath); } } DefaultIndexReaderFactory(MountInfoProvider mountInfoProvider, @Nullable IndexCopier cloner); }
DefaultIndexReaderFactory implements LuceneIndexReaderFactory { @Override public List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState, String indexPath) throws IOException { if (!mountInfoProvider.hasNonDefaultMounts()) { LuceneIndexReader reader = createReader(definition, defnState, indexPath, FulltextIndexConstants.INDEX_DATA_CHILD_NAME, SUGGEST_DATA_CHILD_NAME); return reader != null ? ImmutableList.of(reader) : Collections.<LuceneIndexReader>emptyList(); } else { return createMountedReaders(definition, defnState, indexPath); } } DefaultIndexReaderFactory(MountInfoProvider mountInfoProvider, @Nullable IndexCopier cloner); @Override List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState,
                                                 String indexPath); @Override MountInfoProvider getMountInfoProvider(); }
DefaultIndexReaderFactory implements LuceneIndexReaderFactory { @Override public List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState, String indexPath) throws IOException { if (!mountInfoProvider.hasNonDefaultMounts()) { LuceneIndexReader reader = createReader(definition, defnState, indexPath, FulltextIndexConstants.INDEX_DATA_CHILD_NAME, SUGGEST_DATA_CHILD_NAME); return reader != null ? ImmutableList.of(reader) : Collections.<LuceneIndexReader>emptyList(); } else { return createMountedReaders(definition, defnState, indexPath); } } DefaultIndexReaderFactory(MountInfoProvider mountInfoProvider, @Nullable IndexCopier cloner); @Override List<LuceneIndexReader> createReaders(LuceneIndexDefinition definition, NodeState defnState,
                                                 String indexPath); @Override MountInfoProvider getMountInfoProvider();  }