Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-29-2019 11:26 AM
However, there is no longer any path for indexing values in a list property.
{ mylistprop: ['name1', 'name2','indexme2'] }
There are multiple uses and applications for indexing such that name1, name2, indexme2
are each a key in the index pointing a single node.
CREATE (:Thing {name: 'thing1', listprop: ['thing1', 'alias', 'alias 2']})
CREATE (:Thing {name: 'thing2', listprop: ['thing2', 'aka', 'another thing']})
Desired index:
'alias' → (thing1)
'alias 2' → (thing1)
'aka' → (thing2)
'another thing' → (thing2)
Intended Use
CALL apoc.load.json(url) YIELD value
WHERE exists(value.name)
OPTIONAL MATCH (prime:Thing {listprop: value.name})
USING INDEX prime:Thing(listprop)
WITH value as imported, CASE WHEN prime IS NOT NULL THEN prime ELSE value END AS target
MERGE (x:Thing {name: target.name})
SET x = target
SET x.listprop = apoc.coll.toSet(target.listprop + imported.name)
MERGE (:Meta {usefuldetail: 'graph-power'})-[:ABOUT]->(target)
DEPRECATED (will be removed in Neo4j 4.x):
Neo4j, Cypher Manual indexing, and apoc.index.*
.
That leaves four ways to accomplish this goal, all of which are bad options:
whitespace
fulltext index analyzer.I suspect I'm missing something simple, and I may simply go the way of option 1 in the interest of preserving data. However, in many cases, including mine, this creates an n-to-n problem, where the resulting data will be Nodes^n resulting nodes and relationships, effectively many times larger than necessary.
Am I missing something obvious to anyone?
08-30-2019 11:09 AM
I guess for now, I'll go with the "blow up my database" option, and hopefully find some time to explore adding a better solution into a Neo4j 4.5-ish at some point.
05-11-2020 05:46 AM
I've just started using Neo4j 4.03 and it looks like lists in nodes are stored as strings when the nodes are created by Load CSV. I could unwind them in v3.x, but cannot in v4.x.
All the sessions of the conference are now available online