为不同的项目使用相同的neo4j数据库和索引

时间:2012-04-29 12:20:06

标签: lucene indexing neo4j

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

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

项目1:

GraphDatabaseService greatest = new EmbeddedGraphDatabase(graphLocation);

IndexManager greatestManager = greatest.index();

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

项目2:

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;
}

great.countHits ==&gt; 100多个节点

second.countHits ==&gt;的NullPointerException

0 个答案:

没有答案