From 2727523540c3df6a6abc0a1911b43899de2fe1a5 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Thu, 19 Sep 2024 19:36:13 -0300 Subject: [PATCH] feat: order search by followers count also --- src/utils/search.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/search.ts b/src/utils/search.ts index 5ca43417..e17be135 100644 --- a/src/utils/search.ts +++ b/src/utils/search.ts @@ -10,13 +10,14 @@ export async function getPubkeysBySearch( const { q, limit, followedPubkeys } = opts; let query = kysely - .selectFrom('author_search') + .selectFrom('author_stats') .select((eb) => [ 'pubkey', 'search', eb.fn('word_similarity', [sql`${q}`, 'search']).as('sml'), ]) .where(() => sql`${q} <% search`) + .orderBy(['followers_count desc']) .orderBy(['sml desc', 'search']) .limit(limit);