I'm guessing you could have a Trigger that checks whenever a FOOD and/or FRUIT label gets added to an existing Node and/or when the Node gets created with the Label and then automatically creates the Union of the two.
I tried seeing if I could find the source on GitHub for db.index.fulltext.createNodeIndex, which is where this would need to be tweaked but I'm not sure where to find it...
Ok I will try it. What about scalability performance. It won’t affect it if my database will grow much? It’s more theoretical question.
What if I will change label from FRUIT to VEGETABLE? Should I create trigger which will automatically change the “combined” label.
Also there is another thing. I want to have indexes which different depth levels. For example I want to have index for FOOD, for FOOD DIARY and for FOOD DIARY MILLILITERS. So every node should have 3 additional “combined” labels based on single ones, right?
I’m here focused on read speed and don’t care much about write speed.
Overall it would be nice to have indexes based on on nodes with both labels.
I think createNodeIndex doesn’t allow it alone.
I agree that your use case is a reasonable one (although uncommon.)
It needs to be made as a request to the APOC powers.
Or if you or somebody you know is clever enough, to make an addition to the db.index.fulltext to have a version of the function that requires all the Labels in the list instead of any Label. Then make a Pull Request to have it added.
I'm stumped as to where the source code is, otherwise I might take a crack at it myself (just for the experience.)