The relevant schema:
<hashtag.hashtag>: string @index(exact, fulltext) @count .
<hashtag.indices>: [int] .
<tweet.hashtag>: uid @count .
<tweet.text>: string @index(exact, fulltext) @upsert @count .I have a collection of Tweet nodes, which are associated with a handful of Hashtag nodes that represent parsed hashtags.
I'm trying to perform a search query that retrieves Tweet nodes in which the associated tweet.hashtag node contains a hashtag.hashtag edge value matching a given search.
For example, a Tweet node with a tweet.text value of "@Ladarius93 Persevering discrete algorithm #global #B2B" has a tweet.hashtag edge pointing to a Hashtag node with a hashtag.hashtag value of "global." Therefore, I'm trying to create a query that will allow me to retrieve the parent Tweet node when searching for the hashtag.hashtag value of "global."
# query
{
tweet(func: uid(0x56bc9)) {
uid
tweet.text
tweet.hashtag {
uid
expand(_all_)
}
}
}Result:
{
"data": {
"tweet": [
{
"uid": "0x56bc9",
"tweet.text": "@Ladarius93 Persevering discrete algorithm #global #B2B",
"tweet.hashtag": [
{
"uid": "0x56bc7",
"hashtag.hashtag": "global",
"hashtag.indices": [
43,
50
]
},
{
"uid": "0x56bc8",
"hashtag.hashtag": "B2B",
"hashtag.indices": [
51,
55
]
}
]
}
]
},
}I've tried a combination of queries similar to the following, with no luck:
{
tags as tag(func: anyoftext(hashtag.hashtag, "global")) {
uid
hashtag.hashtag
hashtag.indices
}
filteredTweets(func: has(tweet.text)) {
uid
tweet.text
tweet.hashtag @filter(uid(tags))
}
}Even though the tags variable result works and only returns the collection of Hashtag nodes in which hashtag.hashtag contains "global", the filteredTweets query returns the entire collection of Tweets (that is, anything that has tweet.text edge).
Any help would be appreciated.