Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Neo4j中按索引查询时,部分结果得到NaN lucene分数_Java_Neo4j_Lucene - Fatal编程技术网

Java 在Neo4j中按索引查询时,部分结果得到NaN lucene分数

Java 在Neo4j中按索引查询时,部分结果得到NaN lucene分数,java,neo4j,lucene,Java,Neo4j,Lucene,在neo4j中,我使用自定义分析器构建lucene索引。然而,当在索引中搜索时,一些查询结果会得到一个NaN分数 源代码: try (Transaction tx = Neo4j.graphDb.beginTx()) { IndexManager index = Neo4j.graphDb.index(); /**query*/ Index<Node> addressNodeFullTextIndex = index.forNodes(

在neo4j中,我使用自定义分析器构建lucene索引。然而,当在索引中搜索时,一些查询结果会得到一个NaN分数

源代码:

try (Transaction tx = Neo4j.graphDb.beginTx()) {
        IndexManager index = Neo4j.graphDb.index();
        /**query*/
        Index<Node> addressNodeFullTextIndex = index.forNodes("NodeFullTextIndex",
                MapUtil.stringMap(IndexManager.PROVIDER, "lucene", "analyzer", IKAnalyzer5x.class.getName()));
        Query test = IKQueryParser.parseMultiField(fields, query);
        IndexHits<Node> foundNodes = addressNodeFullTextIndex.query(test);

        for(Node n : foundNodes){
            Map<String, Object> m = n.getAllProperties();
            m.put("score", foundNodes.currentScore());
            log.info("method[selectByIndex] score<"+foundNodes.currentScore()+">");
            ret.add(m);

        }
        tx.success();
    } catch (IOException e) {
        log.error("method[selectByIndex] fields<"+Joiner.on(",").join(fields)+"> query<"+query+">", e);
        throw e;
    }
try(事务tx=Neo4j.graphDb.beginTx()){
IndexManager index=Neo4j.graphDb.index();
/**质疑*/
索引地址nodobletextindex=Index.forNodes(“nodobletextindex”,
stringMap(IndexManager.PROVIDER,“lucene”,“analyzer”,IKAnalyzer5x.class.getName());
querytest=IKQueryParser.parseMultiField(字段,查询);
IndexHits foundNodes=AddressNodeFileLTExtIndex.query(测试);
用于(节点n:foundNodes){
Map m=n.getAllProperties();
m、 put(“score”,foundNodes.currentScore());
log.info(“方法[selectByIndex]得分”);
再加上(m);
}
成功();
}捕获(IOE异常){
log.error(“方法[selectByIndex]字段查询”,e);
投掷e;
}
这就是结果:

[
{
“分数”:4.786232,
“知识名称”:信阳市科学技术局",
“知识id”:“baidubaike_4658797/4658797”
},
{
“分数”:1.4323579,
“知识名称”:信阳市人事局",
“知识id”:“baidubaike_4658842/4658842”
},
{
“分数”:楠,
“知识名称”:信阳市农业局",
“知识id”:“baidubaike_4658885/4658885”
}
]

neo4j版本:3.1.0 Lucene版本:5.5.0

您可以看到一些分数代码获得了一个NaN值,为什么?或者查询代码中是否有错误