-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
area/indexesRelated to indexes (indices) and their usage.Related to indexes (indices) and their usage.area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.priority/P3Low priority, something to be done once everything else seems fixed.Low priority, something to be done once everything else seems fixed.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.status/needs-attentionThis issue needs more eyes on it, more investigation might be required before accepting/rejecting itThis issue needs more eyes on it, more investigation might be required before accepting/rejecting it
Description
Hello,
When using the count index at the query root, I regularly need to get values lower than a threshold, including zero.
For instance, suppose I have products connected to suppliers and I’d like to known when there are not enough suppliers. I could use the following query:
{
me(func:lt(count(supplier), 3)) {
uid
product_name
}
}
But I will miss the products with 0 suppliers: the most important ones to me.
I could use a second query block with a filter not has(supplier) but it is no efficient as not using any index.
What about adding an option on @count index to also track 0 counts?
It could be tracked only for the types containing the predicates with those indexes.
For example :
type Product {
supplier
}
supplier: [uid] @count(zero) .
Original forum thread: https://discuss.dgraph.io/t/tracking-zero-counts/6235
Metadata
Metadata
Assignees
Labels
area/indexesRelated to indexes (indices) and their usage.Related to indexes (indices) and their usage.area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.priority/P3Low priority, something to be done once everything else seems fixed.Low priority, something to be done once everything else seems fixed.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.status/needs-attentionThis issue needs more eyes on it, more investigation might be required before accepting/rejecting itThis issue needs more eyes on it, more investigation might be required before accepting/rejecting it