0

如何配置程序以使用另一个创建的 lucene 全文节点索引?

我有两个项目可以访问同一个 neo4j 数据库。第二个项目连接到数据库,识别现有索引,但索引查询返回空指针错误。第一个项目中创建索引的相同查询代码将返回 100 多个节点。谢谢

项目一:

GraphDatabaseService greatest = new EmbeddedGraphDatabase(graphLocation);

IndexManager greatestManager = greatest.index();

Index<Node> greatestIndex = greatestManager.forNodes("property1",MapUtil.stringMap(IndexManager.PROVIDER, "lucene", "type", "fulltext"));

项目二:

GraphDatabaseService second = new EmbeddedGraphDatabase(graphLocation);

IndexManager secondManager = second.index();


public Integer countHits() {
    IndexHits<Node> hits = greatestIndex.query("property1", new QueryContext("*"));
    Integer hitsSize = hits.size();
    return hitSize;
}

最大.countHits ==> 100+ 个节点

second.countHits ==> NullPointerException

4

0 回答 0