How can I query facets with multi-property [ better facets dgraph in v1.1.1]

I saw a useful new feature in dgraph v1.1.1

{
  set {
    _:p <name> "Diggy" (since=2012).
    _:p <name> "Dazzy" (since=2013).
    _:p <plays> "Drums" (since=2010-01-01) .
    _:p <plays> "Piano" (since=2015-01-01) .
    _:p <plays> "Violin" (since=2019-01-01) .
  }
}

There’s multi value for <plays>
so the schema of <plays> should be a list.

 plays [string] .

It’s ture I can filter the node or property with facets like the example in the Blog above.
The problem is I can not query the facets value if there the property’s schema is a list.

{
  q(func: has(plays)) {
    name 
    plays @facets
  }
}

As far I can tell, there’s no support for this

Thanks for your reply,
In the example of the releasing blog
Dizzy can play multi instruments, so <plays> should be a list of string.
otherwise when mutation

_:Dizzy: <plays> "Violin" .

will overwirte things we set before.

https://github.com/dgraph-io/dgraph/pull/4267

Yep, that was a typo. But indeed this isn’t supported yet. As you can see in the PR you’ve shared. Which isn’t merged to the master branch.

with dgraph v1.1.1
I can do filter with the facets and get the right result, so I think this means the factes we set were stored correctly,
BUT is there a way I can get the value facts in a query?

{
  q(func: has(name)) {
		 name
    plays @facets(lt(since, 2030))
  }
}

I’m processing with data just like Dizzy,there maybe multi value in a list of property. It’s a useful way for me to store facets for each value.
Is there a chance we can get this feature in the future?

This is a false flag. Some bug let you get the values using the facet syntax. But [lists] can’t have facets until the PR #4267 is merged.

Yes, just wait for the PR to get merged. There are some reviews to be done.

About the Blog post. I’m not sure why it was announced there, this feature. Maybe it was supposed to mean that in “early future” you’ll be able to do it.

I already asked why it was posted like that. But I think it was a misunderstanding.

1 Like

I try to get the facets with the [lists], it can get the correct results in this version,
the problem seem to be how to Get the [lists] facets.

{
  set {
    _:p <name> "Diggy" (since=2012).
    _:p <plays> "Drums" (since=2010-01-01) .
    _:p <plays> "Piano" (since=2015-01-01) .
    _:p <plays> "Violin" (since=2019-01-01) .
  }
}

Thanks for you help!
This is a convience way to process data have multi values, but I saw the PR wasn’t being process for a long time, will this be fixed soon?

I think this is related to this PR Support filtering by facets on values. by martinmr · Pull Request #4217 · dgraph-io/dgraph · GitHub

Dunno. Some guys are on vacation. So things get slow during the festivities.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.