mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: if statement lexemes
This commit is contained in:
parent
e8c66c77fc
commit
d06e0311c9
1 changed files with 2 additions and 2 deletions
|
|
@ -44,13 +44,13 @@ export async function getIdsBySearch(
|
||||||
): Promise<Set<string>> {
|
): Promise<Set<string>> {
|
||||||
const { q, limit, offset } = opts;
|
const { q, limit, offset } = opts;
|
||||||
|
|
||||||
const lexemes = await kysely.selectNoFrom(
|
const [lexeme] = await kysely.selectNoFrom(
|
||||||
sql`phraseto_tsquery(${q})` as unknown as SelectExpression<DittoTables, never>,
|
sql`phraseto_tsquery(${q})` as unknown as SelectExpression<DittoTables, never>,
|
||||||
)
|
)
|
||||||
.execute() as { phraseto_tsquery: 'string' }[];
|
.execute() as { phraseto_tsquery: 'string' }[];
|
||||||
|
|
||||||
// if it's just stop words, don't bother making a request to the database
|
// if it's just stop words, don't bother making a request to the database
|
||||||
if (!lexemes[0].phraseto_tsquery) {
|
if (!lexeme.phraseto_tsquery) {
|
||||||
return new Set();
|
return new Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue