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
Copy file name to clipboardExpand all lines: lib/queries.dart
+9-8
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
// ! This file contains all SurrealQL queries used for @skyfeed.xyz custom feeds
2
2
3
3
final surrealQueries = {
4
-
// ! Discover: Posts a user might enjoy, based on like history. Works by collecting your past likes of less popular posts, searching the network for users who have a similar like history, aggregating their recent likes and then ranking based on the sum of all the curator weights.
4
+
// ! Discover: Posts a user might enjoy, based on like history. Works by collecting your past likes of less popular posts, searching the network for users who have a similar like history, aggregating their recent likes and then ranking based on the sum of all the curator weights.
5
5
'discover':
6
6
r'''LET $liked_posts = (SELECT ->(like WHERE createdAt > (time::now() - 168h) AND meta::tb(out) == 'post') as likes FROM $feeduserdid).likes.out;
7
7
LET $liked_posts2 = (SELECT * FROM (SELECT id, type::thing('like_count_view', [id]).likeCount AS likeCount FROM $liked_posts) WHERE likeCount > 1 ORDER BY likeCount ASC LIMIT 64).id;
@@ -31,11 +31,11 @@ SELECT id,createdAt FROM post WHERE record != NONE AND meta::tb(record) == 'feed
31
31
'catch-up':
32
32
r'select subject as id, likeCount from like_count_view where likeCount > 68 and subject.createdAt > (time::now() - 24h) order by likeCount desc limit 1000;',
33
33
34
-
// ! Catch Up Weekly: Most liked posts from the last 7 days
34
+
// ! Catch Up Weekly: Most liked posts from the last 7 days
35
35
'catch-up-weekly':
36
36
r'select subject as id, likeCount from like_count_view where likeCount > 130 and subject.createdAt > (time::now() - 168h) order by likeCount desc limit 1000;',
37
37
38
-
// ! Art New: Powers the @bsky.art feed
38
+
// ! Art New: Powers the @bsky.art feed
39
39
'art-new':
40
40
r'''LET $artists = (select ->follow.out as following from did:plc_y7crv2yh74s7qhmtx3mvbgv5).following;
41
41
LET $posts = array::flatten(array::flatten((SELECT (SELECT ->posts.out as posts FROM $parent.id) AS posts FROM $artists).posts.posts));
@@ -44,12 +44,13 @@ LET $hashtag_posts = (SELECT ->usedin.out AS posts FROM hashtag:art).posts;
44
44
return SELECT id,createdAt FROM array::distinct(array::concat($hashtag_posts,array::concat($posts,$reposts))) WHERE count(images) > 0 ORDER BY createdAt DESC LIMIT 1000;
45
45
''',
46
46
47
-
// ! Mutuals: Posts from mutual follows
47
+
// ! Mutuals: Posts from mutual follows
48
48
'mutuals':
49
49
r'''LET $res = (select ->follow.out as following, <-follow.in as follows from $feeduserdid);
50
50
LET $mutuals = array::intersect($res.follows, $res.following);
51
51
SELECT id,createdAt FROM array::flatten(array::flatten((SELECT (SELECT ->(posts WHERE createdAt > (time::now() - 168h)).out as posts FROM $parent.id) AS posts FROM $mutuals).posts.posts)) ORDER BY createdAt DESC LIMIT 1000;''',
52
-
// ! Re+Posts: Posts and Reposts from people you are following
52
+
53
+
// ! Re+Posts: Posts and Reposts from people you are following
53
54
're-plus-posts':r'''
54
55
LET $following = (select ->follow.out as following FROM $feeduserdid).following;
55
56
@@ -59,16 +60,16 @@ LET $posts = SELECT id,createdAt FROM array::flatten(array::flatten((SELECT (SEL
59
60
SELECT * FROM array::concat($reposts,$posts) ORDER BY createdAt DESC LIMIT 1000;
60
61
''',
61
62
62
-
// ! OnlyPosts: Only posts from people you are following, nothing else
63
+
// ! OnlyPosts: Only posts from people you are following, nothing else
63
64
'only-posts':
64
65
r'''LET $following = (select ->follow.out as following FROM $feeduserdid).following;
65
66
SELECT id,createdAt FROM array::flatten(array::flatten((SELECT (SELECT ->(posts WHERE createdAt > (time::now() - 72h)).out as posts FROM $parent.id) AS posts FROM $following).posts.posts)) ORDER BY createdAt DESC LIMIT 1000;''',
66
67
67
-
// ! What's warm: Posts with 6+ likes from the last hour
68
+
// ! What's warm: Posts with 6+ likes from the last hour
68
69
'whats-warm':
69
70
r'SELECT subject as id, subject.createdAt as createdAt FROM like_count_view WHERE likeCount > 5 AND subject.createdAt > (time::now() - 1h) order by createdAt desc;',
70
71
71
-
// ! What's Reposted: Posts with 5+ reposts
72
+
// ! What's Reposted: Posts with 5+ reposts
72
73
'whats-reposted':
73
74
'select id,createdAt from post where parent == NONE and createdAt > (time::now() - 6h) and count(<-repost) > 4 order by createdAt desc;',
0 commit comments