You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
List of changes needed for Olympia in order to support forum thread tags functionality:
Runtime
create_thread extrinsic - change title argument name to metadata, as it will become the encoded thread metadata which includes both thread title and tags
edit_thread_title extrinsic and ThreadTitleUpdated event - change names to edit_thread_metadata and ThreadMetadataUpdated, as this extrinsic will be used to update both forum title and tags.
Protobuf messages
We need a new protobuf message to represent the thread metadata:
It will be used both when creating a new thread and updating a thread, as described in the Query node mappings section below.
Query node input schema
We need a new entity like ForumThreadTag, with many-to-many relationship to ForumThread, ie.:
typeForumThreadTag@entity {
"Tag name"name: String!@unique"Threads that use this tag"threads: [ForumThread!] @derivedFrom(field: "tags")
"Number of threads that use this tag"threadsCount: Int!
}
typeForumThread@entity {
"Runtime thread id"id: ID!"Related thread tags"tags: [ForumThreadTag!]
# ...
}
Notice that currently we need a separate threadsCount field in ForumThreadTag, because aggregate queries are not yet supported (Joystream/hydra#195)
Query node mappings
After deserializing the tags from ForumThreadMetadata, the query node will:
slice the array so that only the max. allowed number of tags per thread remains (ie. 4)
iterate over remaining tags and insert a new ForumThreadTag into the database for each tag that doesn't yet have a matching entry in the database (we could additionaly normalize all tags with, for example, toLowerCase() and trim(), in order to avoid duplications).
When handling ThreadMetadataUpdated event:
no value for tags would mean we leave current thread tags unaffected
any value (including empty array) means we override all existing tags relationships with the new ones (we don't support atomically adding / removing just a single tag)
we must update threadCount accordingly in all unset / set tags.
Pioneer v2
The input schema menioned above should be enough to support all the queries required by Pioneer, for example:
Then count how many times each unique tag appears in the result. The tags that appear most often are most related to the tag that's beeing searched for (SomeTag in this example), meaning, they most often appear together with SomeTag.
The text was updated successfully, but these errors were encountered:
List of changes needed for Olympia in order to support forum thread tags functionality:
Runtime
create_thread
extrinsic - changetitle
argument name tometadata
, as it will become the encoded thread metadata which includes both thread title and tagsedit_thread_title
extrinsic andThreadTitleUpdated
event - change names toedit_thread_metadata
andThreadMetadataUpdated
, as this extrinsic will be used to update both forum title and tags.Protobuf messages
We need a new protobuf message to represent the thread metadata:
It will be used both when creating a new thread and updating a thread, as described in the Query node mappings section below.
Query node input schema
We need a new entity like
ForumThreadTag
, with many-to-many relationship toForumThread
, ie.:Notice that currently we need a separate
threadsCount
field in ForumThreadTag, because aggregate queries are not yet supported (Joystream/hydra#195)Query node mappings
After deserializing the
tags
fromForumThreadMetadata
, the query node will:slice
the array so that only the max. allowed number of tags per thread remains (ie.4
)ForumThreadTag
into the database for each tag that doesn't yet have a matching entry in the database (we could additionaly normalize all tags with, for example,toLowerCase()
andtrim()
, in order to avoid duplications).When handling
ThreadMetadataUpdated
event:tags
would mean we leave current thread tags unaffectedthreadCount
accordingly in all unset / set tags.Pioneer v2
The input schema menioned above should be enough to support all the queries required by Pioneer, for example:
Listing tags alphabetically
Listing 10 most popular tags
Listing all existing tags starting with characters entered by the user
Related tags
In order to find tags that are related to a tag, Pioneer can execute a query like:
Then count how many times each unique tag appears in the result. The tags that appear most often are most related to the tag that's beeing searched for (
SomeTag
in this example), meaning, they most often appear together withSomeTag
.The text was updated successfully, but these errors were encountered: