Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-29-2020 10:47 PM
CALL db.index.fulltext.createNodeIndex("titlesAndDescriptions",["Movie", "Book"],["title", "description"])
If my graph have lots of node types and each one has a 'name' property, can I create full text index on all nodes with one command? Something like:
`CALL db.index.fulltext.createNodeIndex("nameIndex",[],["name"])`
Failed to invoke procedure `db.index.fulltext.createNodeIndex`: Caused by: java.lang.IllegalArgumentException: Schema descriptor must have at least one label.
10-30-2020 01:23 AM
Hello @lingvisa
The first solution I see is to specify all labels, the list of labels cannot be empty
Regards,
Cobra
10-30-2020 01:31 AM
@Cobra is right, fulltext indexes are always based on labels or relationshipTypes plus properties.
Assuming each of you nodes does have a label (aka you don't have unlabeled nodes) you could do easily collect all the labels you have and build a index on that collection:
call db.labels() yield label with collect(label) as labels
call db.index.fulltext,createNodeIndex("nameIndex", labels, ["name"])
10-30-2020 08:38 AM
That's true. In code it's simple to do. A related question regarding fulltext query. Since it directly searches on dedicated indexes, rather than regular properties, so it doesn't speed up to add MATCH ... WHERE clause to CALL clause:
MATCH (n:Product)
WHERE n.price<1000
CALL db.index.fulltext.queryNodes("titleIndex", "title") YIELD node, score
RETURN node.title, score
MATCH ... WHERE shouldn't be used here?
10-30-2020 09:04 AM
Yes you can directly start with:
CALL db.index.fulltext.queryNodes("titleIndex", "title") YIELD node, score
Regards,
Cobra
10-30-2020 09:28 AM
@Cobra, my question is, add the usual MATCH and WHERE clause to fulltext queries won't help performance for fulltext queries. Right?
10-31-2020 03:33 AM
No, it won't help, it's useless.
All the sessions of the conference are now available online