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
This is different from #46 which topic was removed from the struct. #hashtag as a topic has been a generic behaviour on social media. We should support this on Desmos and posts can be indexed and searched by #hashtags.
If we support this, each post should be tagged by the #hashtag in the content itself. It should be done directly on chain if this will not generate too much overhead.
The text was updated successfully, but these errors were encountered:
Adding this feature is actually quite simple. The things that needs to be done are the following.
Each time a post is saved, we get all the hashtags that are contained inside such post. This can be done using the following regex:
#[A-Za-z0-9]*
Once we have all the hashtags present inside that post, we simply store the reference of that post associating it to the various hashtags it contains. This can be done by having a data structure like the following:
Hashtag -> [PostID]
With this implementation we should have an O(1) lookup time for all the posts that contain a specific hashtag.
Note
We need to make sure that upon editing a post message, we delete the previous references of that post inside the various hashtags.
Let's consider the following initial message (with an hypothetical id of 1):
Are you ready for #desmos?
This would have the following association:
#desmos -> [1]
Now, assume the user changes the message to
Are you ready for #mooncake?
What we would have to do is changing the association to be
#mooncake -> [1]
#desmos -> []
Solution
This can be achieved by the following procedure to be put inside the post edit:
This is different from #46 which topic was removed from the struct.
#hashtag
as a topic has been a generic behaviour on social media. We should support this on Desmos and posts can be indexed and searched by#hashtag
s.If we support this, each post should be tagged by the
#hashtag
in the content itself. It should be done directly on chain if this will not generate too much overhead.The text was updated successfully, but these errors were encountered: