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.
@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"])
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?