use of org.eclipse.che.api.vfs.search.Searcher in project che by eclipse.
the class FSLuceneSearcherProviderTest method returnsSameInstanceOfSearcherOnceItWasCreated.
@Test
public void returnsSameInstanceOfSearcherOnceItWasCreated() throws Exception {
VirtualFileSystem virtualFileSystem = mockVirtualFileSystem();
Searcher searcher = fsLuceneSearcherProvider.getSearcher(virtualFileSystem, true);
assertNotNull(searcher);
assertSame(searcher, fsLuceneSearcherProvider.getSearcher(virtualFileSystem, true));
}
use of org.eclipse.che.api.vfs.search.Searcher in project che by eclipse.
the class MemoryLuceneSearcherProviderTest method closesSearcherWhenProviderIsClosed.
@Test
public void closesSearcherWhenProviderIsClosed() throws Exception {
Searcher searcher = mock(Searcher.class);
memoryLuceneSearcherProvider.searcherReference.set(searcher);
memoryLuceneSearcherProvider.close();
verify(searcher).close();
}
use of org.eclipse.che.api.vfs.search.Searcher in project che by eclipse.
the class MemoryLuceneSearcherProviderTest method returnsSameInstanceOfSearcherOnceItWasCreated.
@Test
public void returnsSameInstanceOfSearcherOnceItWasCreated() throws Exception {
VirtualFileSystem virtualFileSystem = mockVirtualFileSystem();
Searcher searcher = memoryLuceneSearcherProvider.getSearcher(virtualFileSystem, true);
assertNotNull(searcher);
assertSame(searcher, memoryLuceneSearcherProvider.getSearcher(virtualFileSystem, false));
}
use of org.eclipse.che.api.vfs.search.Searcher in project che by eclipse.
the class IndexedFileCreateConsumer method accept.
@Override
public void accept(Path path) {
try {
VirtualFileSystem virtualFileSystem = vfsProvider.getVirtualFileSystem();
SearcherProvider searcherProvider = virtualFileSystem.getSearcherProvider();
Searcher searcher = searcherProvider.getSearcher(virtualFileSystem);
Path innerPath = root.toPath().relativize(path);
org.eclipse.che.api.vfs.Path vfsPath = org.eclipse.che.api.vfs.Path.of(innerPath.toString());
VirtualFile child = virtualFileSystem.getRoot().getChild(vfsPath);
if (child != null) {
searcher.add(child);
}
} catch (ServerException e) {
LOG.error("Issue happened during adding created file to index", e);
}
}
use of org.eclipse.che.api.vfs.search.Searcher in project che by eclipse.
the class IndexedFileDeleteConsumer method accept.
@Override
public void accept(Path path) {
try {
VirtualFileSystem virtualFileSystem = vfsProvider.getVirtualFileSystem();
SearcherProvider searcherProvider = virtualFileSystem.getSearcherProvider();
Searcher searcher = searcherProvider.getSearcher(virtualFileSystem);
Path innerPath = root.toPath().relativize(path);
searcher.delete("/" + innerPath.toString(), true);
} catch (ServerException e) {
LOG.error("Issue happened during removing deleted file from index", e);
}
}
Aggregations