Rename search no-match SQL helper

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-05-05 12:16:59 -05:00
1 parent a7c593ce95
commit d709f10c07
1 file changed
+4 -4
+4 -4
View File
@@ -95,7 +95,7 @@ function tokenMatchExpression(textExpression: SQL, tokenArray: SQL) {
`;
}
function positiveSql() {
function noMatchSql() {
return sql<boolean>`false`;
}
@@ -409,10 +409,10 @@ export function companySearchService(db: Db) {
FROM unnest(${fuzzyTokenArray}) AS qt(value)
), false)
`
: positiveSql();
: noMatchSql();
const fuzzyIdentifierMatch = fuzzyEnabled
? sql<boolean>`similarity(lower(coalesce(${issues.identifier}, '')), ${normalizedQuery}) >= ${FUZZY_IDENTIFIER_SIMILARITY_THRESHOLD}`
: positiveSql();
: noMatchSql();
const fuzzyMatch = sql<boolean>`(${fuzzyTokenTitleMatch} OR ${fuzzyIdentifierMatch})`;
const tokenCoverage = sql<number>`
(
@@ -446,7 +446,7 @@ export function companySearchService(db: Db) {
const tokenCount = tokens.length;
const allTokensMatch = tokenCount > 0
? sql<boolean>`${tokenCoverage} = ${tokenCount}`
: positiveSql();
: noMatchSql();
const score = sql<number>`
(
CASE WHEN lower(coalesce(${issues.identifier}, '')) = ${normalizedQuery} THEN 1200 ELSE 0 END