mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 18:19:05 +02:00
Rename search no-match SQL helper
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a7c593ce95
commit
d709f10c07
1 file changed
+4
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user