Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-16-2018 10:03 AM
Is it possible to apply an index to a list of (string) values, so that you can efficiently look up "all nodes with a list property that contains X".
I have tried creating the index, and adding a list of strings, but any cypher search I do either returns nothing, or the profile shows the results are obtained via a label scan and not the index.
If it is possible:
a) Does the CREATE INDEX statement need to do anything special?
b) What does the MATCH statement look like?
Thanks,
Dave
12-17-2018 05:22 AM
Currently this kind of lookup isn't supported with schema indexes. We would advise remodeling these as connected nodes to your main node.
For example, if you had something like:
(:Sentence {id:12345, words:['sphynx', 'of', 'black', 'quartz', 'judge', 'my', 'vow']})
We would advise you to remodel such that:
(:Sentence {id:12345})-[:HAS_WORD]->(:Word {word:'sphynx'})
and so forth with a separate :Word node per word, and an index on :Word(word) for quick lookup.
Your :Word nodes would be reused with other :Sentence nodes so you could find similar sentences with the same words:
MATCH (w:Word)<-[:HAS_WORD]-(s:Sentence)
WHERE w.word = 'quartz'
RETURN s
12-18-2018 02:03 AM
Array indexes only find the full array.
You can use a manual index via APOC for that (which indexes each array entry),
or better the new fulltext index for 3.5.
12-20-2018 08:46 AM
Thanks. APOC was going to be plan B, but the additional manual index maintenance was a headache I didn't really want for a solution to an edge case that I'm hoping will never happen. I'm going to give 3.5 a try - it's about time I took a look.
I assume that the Neo4JRule TestRule code (Java) for 3.5 supports this new indexing for my testing entertainment?
01-08-2019 01:18 AM
The new indexes are managed via procedures, so i don't see why not.
12-29-2020 11:20 AM
I tried searching but it's not clear to me if APOC full text search can work on an list of strings. It would be nice if it did.
E.g. If I have a person with nicknames, can I do an APOC full text index and search on the list of nicknames? (I understand the built-in indexing property indexing won't work.)
CREATE (p:Person {name:"Elizabeth", nicknames: [
"Lizzy", "Liz", "Beth", "Betsy"]})
Thanks in advance.
12-30-2020 03:00 PM
The old 3.x indexes supported multi-value arrays/lists as properties. None of the current indexes do. There are a number of feature requests for it but nothing has been decided yet.
12-30-2020 03:08 PM
Is that true for both standard indexing and full text indexing?
Thanks.
01-23-2021 06:22 AM
Yes, true for both types of indexes
04-02-2021 02:10 AM
Thanks, any updates on these feature requests?
04-02-2021 01:22 PM
No changes at this time on this one, though there are other index changes coming down the pipeline.
All the sessions of the conference are now available online