Can we store an array as facet?
Let’s say this is the data which is stored in the database.Now if the query contains apple, I only get path from fruit to shop A.
Problem 1: How to store arrays as facet
Problem 2: How to pick each of values in array and compare it with the string in the query.
Also if both shops hava kiwi in their facet array then both the paths will be taken.
Also, can we use substring functions to get certain portion of facet value?
Eg: if facet value is “apple banana kiwi strawberry” I want to extract each word from this value and compare it with word given by user say pineapple. On comparing this with each word extracted from the facet value we found no word in common so don’t to go that edge else traverse it.
How do I achieve this in Dgraph?
No, you can’t do anything like you mentioned. There’s no array type in Facets.
I recommend that you create an intermediate structure of nodes that will be between these two entities that you show. Facets in Dgraph are pretty simple and they don’t have anything specialized. Facet is a second-class citizen. That is, it cannot be indexed, it cannot be queried directly. It’s mostly used for something like “meta data”.
Could you suggest an approach for this?