Dgraph and fast intersection/union operations

Hello, I have been searching for this special feature (even started my own design and impl) in graph databases. Basically bitmap indexes or similar for set operations (union and intersect) on huge collections of disk stored sets. The objective is to implement what I’d call reverse search queries, where the data to search is the input and the user queries are stored as sets or similar keyword list, I have read somewhere that graphs could have this property of reversing queries and would love to know if dgraph can support it.

Cheers,
Andrés

If I understand correctly, this is what you want.

Text: [The current president of the United States of America is Barak Obama]
Queries: [Barak Obama], [United States], [president], [America], [current president], [Obama], etc. would now all point to this text.

This is more of an indexing problem for search engines than a graph problem. In both the cases, you’d have to generate posting lists, like so:

[Barak Obama] -> list of pages which contain it
[Obama] -> list of pages which contain it
[United States] -> list of pages which contain it
… so on …

These are largely key value pairs, with no need for relationship. Graphs would be useful if your relationship between these had been different. Such is the case with a social graph. If your relationship is only one across the entire data, graphs are not a good solution.

More like:
Text:[punk rock band concert in ohio]
Queries:[rock, concert][punk][music, concert][ethiopia,coffee]
(comma separated terms indicate a set, since list order doesn’t matter)

In this example the union and intersection index would find partial matches except the last one. Here is where I think a graph database might have such indexes for fast union/intersection searches, with the plus that the graph might be helpful to refine the matches (someone who subscribes to [jazz,concert] won’t be interested in [punk, concert]).

The use case is what we could term as “subscription based search”. Rethinkdb has this changefeed feature that allows realtime queries that are pretty useful for realtime/notifications, you can implement this type of subscription based search but in a deterministic way, coupled with the structure of stored records. Something like it would be pretty mindblowing for a graph database.