Getting votes on a particular post? #44
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: golgi-ssb/golgi#44
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@erin asked about how to get votes for a post for their client (https://matrix.to/#/!SrcUDxvxhmyHlrHzgd:matrix.org/$jlkhaDPcOdrs3aPMWcCcghwgqWVcQy3FJS_Yzpwq0yo?via=matrix.org&via=chat.is-cute.ml)
I'm going to look into go-oasis to see if they handled this
I'm intrigued to hear how / if go-oasis did this.
I posted what I found in the #golgi matrix channel
I think it could be a good question to ask the planetary devs about as well
@notplants
Nice detective work. I think that ssb-backlinks creates a database index of all messages which mention / reference another message. This includes votes, since a vote message mentions the message being voted on. It's then relatively fast to query these messages because they've already been indexed (with the index having been stored in the flume database).
+1 very interested to hear how the Planetary devs are doing this.
afaiu Planetary folks are just taking the entire append-only log and piling it into a sqlite database and then the front-end is using that to put together queries and such.
I've opened up https://github.com/ssbc/go-ssb/issues/200 to try to track down how to get only votes on a post.
tangles.thread
gets replies. We're missing something, hopefully I'll manage to figure it out.I currently have
tangles.thread
working on dev branches ofkuska
+golgi
. I'm making sure all the optional args work as expected and then I'll get that all merged.My workaround idea for getting votes on a post would be:
root
field in the message (to get the key of the root msg of the thread)tangles.thread
with the root msg key (returns a stream of messages)vote
which reference the post of interestIf an easier way comes along, awesome!
From my testing, I see that no
type=vote
posts come back in the out ofsbotcli replies
(usestangles.threads
internally)? Lemme know if you see it tho, I might be missing it in the blob-of-JSON-return 🙃Would be great to solve this as I need this functionality too.
Hmm I am seeing votes in some cases but not others (and not all the votes).
Here's an example:
Output:
Only two...should be lots more. Not sure if it's just a case of the other vote messages not having replicated yet?
Here's another one that yields a vote, but in general I'm seeing far fewer than I would expect.
Output:
Right, I think https://github.com/ssbc/go-ssb/issues/251 is the cause for the lack of vote responses. TLDR;
go-sbot
is not correctly indexing all the messages. Working on a fix.