几天以来,我一直在尝试解决这个问题。
我想START
对全文进行查询,按相关性排序,以便对结果进行分页。
很高兴,我终于在全文索引和 neo(并使用python作为驱动程序)上找到了这个线程。
[ https://groups.google.com/forum/#!topic/neo4j/9G8fcjVuuLw]
我已经使用批量超级导入器导入了我的数据库,并得到了@Michaelhunger 的回复,他注意到有一个错误,所有分数都将被导入相同的值。
所以,现在我正在重新创建索引,并通过 REST (&order=score)检查分数
http://localhost:7474/db/data/index/node/myInde?query=name:myKeyWord&order=score
并注意到条目仍然具有相同的分数。
(您必须执行 ajax 查询才能看到它,因为如果您使用 Web 控制台,您将看不到所有数据!!)
我的代码用于重新创建全文 lucene 索引,每个节点属性为“名称”:(此处使用 neo4j-rest-client,但我也会尝试使用 py2neo,如 Google 讨论中的那样):
from neo4jrestclient.client import GraphDatabase
gdb = GraphDatabase("http://localhost:7474/db/data/")
myIndex = gdb.nodes.indexes.create("myIndex", type="fulltext", provider="lucene")
myIndex.add("name",node.get("name"),node)
结果:
http://localhost:7474/db/data/index/node/myInde?query=name:DNA&order=score
data Object {id: 17062920, name: "DNA damage theory of aging"}
VM995:10 **score 11.097855567932129**
...
data Object {id: 17022698, name: "DNA (film)"}
VM995:10 **score 11.097855567932129**
在文档中: [ http://neo4j.com/docs/stable/indexing-lucene-extras.html#indexing-lucene-sort] 写到 Lucene 本身可以很好地进行排序,所以我理解它创建了一个排名单独进口;它不是。
我做错了什么或错过了什么?