mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
refactor: rename queryWithoutPhraseto_tsquery to fallbackQuery
This commit is contained in:
parent
d06e0311c9
commit
f259ab8d88
1 changed files with 3 additions and 3 deletions
|
|
@ -90,7 +90,7 @@ export async function getIdsBySearch(
|
|||
query = query.where('pubkey', 'in', pubkeys);
|
||||
}
|
||||
|
||||
let queryWithoutPhraseto_tsquery = query;
|
||||
let fallbackQuery = query;
|
||||
if (parsedSearch) {
|
||||
query = query.where('search', '@@', sql`phraseto_tsquery(${parsedSearch})`);
|
||||
}
|
||||
|
|
@ -99,12 +99,12 @@ export async function getIdsBySearch(
|
|||
|
||||
// If there is no ids, fallback to `plainto_tsquery`
|
||||
if (!ids.size) {
|
||||
queryWithoutPhraseto_tsquery = queryWithoutPhraseto_tsquery.where(
|
||||
fallbackQuery = fallbackQuery.where(
|
||||
'search',
|
||||
'@@',
|
||||
sql`plainto_tsquery(${parsedSearch})`,
|
||||
);
|
||||
const ids = new Set((await queryWithoutPhraseto_tsquery.execute()).map(({ id }) => id));
|
||||
const ids = new Set((await fallbackQuery.execute()).map(({ id }) => id));
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue