Search in sources :

Example 1 with Neo4jSearcherFactory

use of org.neo4j.kernel.api.impl.index.partition.Neo4jSearcherFactory in project neo4j by neo4j.

the class AllNodesCollector method getAllNodes.

public static List<Long> getAllNodes(Directory directory, Value propertyValue) throws IOException {
    try (SearcherManager manager = new SearcherManager(directory, new Neo4jSearcherFactory())) {
        IndexSearcher searcher = manager.acquire();
        Query query = LuceneDocumentStructure.newSeekQuery(propertyValue);
        AllNodesCollector collector = new AllNodesCollector();
        searcher.search(query, collector);
        return collector.nodeIds;
    }
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) Neo4jSearcherFactory(org.neo4j.kernel.api.impl.index.partition.Neo4jSearcherFactory) Query(org.apache.lucene.search.Query) SearcherManager(org.apache.lucene.search.SearcherManager)

Example 2 with Neo4jSearcherFactory

use of org.neo4j.kernel.api.impl.index.partition.Neo4jSearcherFactory 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());
}
Also used : Neo4jSearcherFactory(org.neo4j.kernel.api.impl.index.partition.Neo4jSearcherFactory) IndexWriter(org.apache.lucene.index.IndexWriter) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) SearcherManager(org.apache.lucene.search.SearcherManager) Directory(org.apache.lucene.store.Directory) TestDirectory(org.neo4j.test.rule.TestDirectory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SearcherManager (org.apache.lucene.search.SearcherManager)2 Neo4jSearcherFactory (org.neo4j.kernel.api.impl.index.partition.Neo4jSearcherFactory)2 IndexWriter (org.apache.lucene.index.IndexWriter)1 IndexSearcher (org.apache.lucene.search.IndexSearcher)1 Query (org.apache.lucene.search.Query)1 Directory (org.apache.lucene.store.Directory)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 DirectoryFactory (org.neo4j.kernel.api.impl.index.storage.DirectoryFactory)1 TestDirectory (org.neo4j.test.rule.TestDirectory)1