use of org.apache.lucene.search.SearcherManager in project neo4j by neo4j.
the class SimpleUniquenessVerifierTest method initLuceneResources.
@BeforeEach
void initLuceneResources() throws Exception {
dirFactory = new DirectoryFactory.InMemoryDirectoryFactory();
Directory dir = dirFactory.open(testDir.directory("test"));
writer = new IndexWriter(dir, IndexWriterConfigs.standard(Config.defaults()));
searcherManager = new SearcherManager(writer, new Neo4jSearcherFactory());
}
use of org.apache.lucene.search.SearcherManager in project orientdb by orientechnologies.
the class OLuceneStorage method reOpen.
private void reOpen() throws IOException {
if (mgrWriter != null) {
OLogManager.instance().info(this, "index storage is open don't reopen");
return;
}
ODatabaseDocumentInternal database = ODatabaseRecordThreadLocal.INSTANCE.get();
final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
Directory dir = null;
if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
String pathname = getIndexPath((OLocalPaginatedStorage) storageLocalAbstract);
OLogManager.instance().info(this, "Opening NIOFS Lucene db=%s, path=%s", database.getName(), pathname);
dir = NIOFSDirectory.open(new File(pathname).toPath());
} else {
OLogManager.instance().info(this, "Opening RAM Lucene index db=%s", database.getName());
dir = new RAMDirectory();
}
final IndexWriter indexWriter = createIndexWriter(dir);
mgrWriter = new TrackingIndexWriter(indexWriter);
searcherManager = new SearcherManager(indexWriter, true, null);
if (nrt != null) {
nrt.close();
}
nrt = new ControlledRealTimeReopenThread(mgrWriter, searcherManager, 60.00, 0.1);
nrt.setDaemon(true);
nrt.start();
flush();
OLogManager.instance().info(this, "REOPEN DONE");
}
use of org.apache.lucene.search.SearcherManager in project OpenGrok by OpenGrok.
the class RuntimeEnvironment method maybeRefreshIndexSearchers.
public void maybeRefreshIndexSearchers() {
LOGGER.log(Level.INFO, "refreshing searcher managers");
Statistics stat = new Statistics();
for (Map.Entry<String, SearcherManager> entry : searcherManagerMap.entrySet()) {
maybeRefreshSearcherManager(entry.getValue());
}
stat.report(LOGGER, "Done refreshing searcher managers");
}
use of org.apache.lucene.search.SearcherManager in project che by eclipse.
the class LuceneSearcher method doInit.
protected final synchronized void doInit() throws ServerException {
try {
luceneIndexWriter = new IndexWriter(makeDirectory(), new IndexWriterConfig(makeAnalyzer()));
searcherManager = new SearcherManager(luceneIndexWriter, true, new SearcherFactory());
closed = false;
} catch (IOException e) {
throw new ServerException(e);
}
}
use of org.apache.lucene.search.SearcherManager in project neo4j by neo4j.
the class AllNodesCollector method getAllNodes.
public static List<Long> getAllNodes(Directory directory, Object propertyValue) throws IOException {
try (SearcherManager manager = new SearcherManager(directory, new SearcherFactory())) {
IndexSearcher searcher = manager.acquire();
Query query = LuceneDocumentStructure.newSeekQuery(propertyValue);
AllNodesCollector collector = new AllNodesCollector();
searcher.search(query, collector);
return collector.nodeIds;
}
}
Aggregations