diff --git a/server/src/services/company-search.ts b/server/src/services/company-search.ts index d7297786afd..a8af1ccc6cb 100644 --- a/server/src/services/company-search.ts +++ b/server/src/services/company-search.ts @@ -95,7 +95,7 @@ function tokenMatchExpression(textExpression: SQL, tokenArray: SQL) { `; } -function positiveSql() { +function noMatchSql() { return sql`false`; } @@ -409,10 +409,10 @@ export function companySearchService(db: Db) { FROM unnest(${fuzzyTokenArray}) AS qt(value) ), false) ` - : positiveSql(); + : noMatchSql(); const fuzzyIdentifierMatch = fuzzyEnabled ? sql`similarity(lower(coalesce(${issues.identifier}, '')), ${normalizedQuery}) >= ${FUZZY_IDENTIFIER_SIMILARITY_THRESHOLD}` - : positiveSql(); + : noMatchSql(); const fuzzyMatch = sql`(${fuzzyTokenTitleMatch} OR ${fuzzyIdentifierMatch})`; const tokenCoverage = sql` ( @@ -446,7 +446,7 @@ export function companySearchService(db: Db) { const tokenCount = tokens.length; const allTokensMatch = tokenCount > 0 ? sql`${tokenCoverage} = ${tokenCount}` - : positiveSql(); + : noMatchSql(); const score = sql` ( CASE WHEN lower(coalesce(${issues.identifier}, '')) = ${normalizedQuery} THEN 1200 ELSE 0 END