Get all keys of the Neo4j index

I have a Neo4j database whose contents are dynamically generated from a large data set.

All nodes of the "entry points" are indexed to the named index ( IndexManager.forNodes(…) ). So I can find the specific node entry point.

However, now I would like to list all these specific nodes, but I can’t know on which key they were indexed.

Is there a way to list all the keys of the Neo4j Index ?

If not, what would be the best way to store these keys, a data type that is highly non-graphically oriented?


UPDATE (thanks for the details: :)): there will be more than 2 million entries in the list. The main use case would never be to update it after the initialization step, but in other use cases it may be required, so it should be somewhat scalable.

In addition, I would prefer not to kill my current resistance abilities, so storing all the keys at once rather than adding them step by step would be the last decision.

+4
source share
4 answers

I would use a different datastore to complement Neo4j - I like Redis- or try the @MattiasPersson suggestion and save the list to node.

+1
source

Is this just one list of keys or a list in node? You can save such a list on a specific node, say a node link.

0
source

Instead of using another repository that increases complexity, you can try again with

  • lucene indices. Normally, lucene is able to handle this easily, especially now when MatchAllDocsQuery is better. but one problem is that neo4j guys are using a very old version of lucene.

  • a special “links” field in each node especially for this case with a key bypass associated with the next node, where you easily get ALL properties :)

0
source

If you want to get all the Nodes indexed at a specific index, you can simply do:

 IndexHits<Node> hits = IndexManager.forNodes(<INDEX_NAME>).query("*:*"); try{ while(hits.hasNext()){ Node n = hits.next(); ...process the node... } }finally{ hits.close(); } 
-1
source

Source: https://habr.com/ru/post/1412664/


All Articles