Neo4j has two types of indexes, node and relationship indexes. With
node indexes you index and find nodes, and with relationship indexes
you do the same for relationships.
Each index has a provider, which is the underlying implementation
handling that index. The default provider is lucene, but you can
create your own index provides if you like.
Neo4j indexes take key/value/object triplets ("object" being a node or
a relationship), it will index the key/value pair, and associate this
with the object provided. After you have indexed a set of
key/value/object triplets, you can query the index and get back
objects that where indexed with key/value pairs matching your query.
For instance, if you have "User" nodes in your database, and want to
rapidly find them by username or email, you could create a node index
named "Users", and for each user index username and email. With the
default lucene configuration, you can then search the "Users" index
with a query like: "username:bob OR email:bob@gmail.com".
You can use the data browser to query your indexes this way, the
syntax for the above query is "node:index:Users:username:bob OR
email:bob@gmail.com".
neo4jrestclient支持索引和遍历图形,但我认为仅使用索引对您的用例来说是非常有用的。不过,我不知道我是否理解你的问题。不管怎样,这样的方法可能会奏效:
我们将属性
^{pr2}$count
添加到关系中,以跟踪标记foobar
标记的"http://foo.bar"
的数量。在然后,我们根据url的值索引url节点。在
然后,当我需要创建一个用标记节点标记的新URL节点时,我们首先查询索引以检查它是否已被索引。否则,我们创建节点并索引它。在
一个重要的概念是,索引是key/value/object三元组,其中对象要么是一个节点,要么是一个要索引的关系。在
创建和使用索引的步骤:
创建图形数据库rest客户机的实例。在
创建节点或关系索引(在此处创建节点索引)
^{pr2}$向索引添加节点
根据索引获取节点并进行进一步处理:
更多细节可以从webadmin中的注释中找到
相关问题 更多 >
编程相关推荐