refactor(editor): Boost n8n Form Trigger in nodes-panel search results (#10294)

This commit is contained in:
Iván Ovejero
2024-08-05 17:52:46 +02:00
committed by GitHub
parent c0bdf3b719
commit 74e154b130
2 changed files with 7 additions and 5 deletions

View File

@@ -139,10 +139,12 @@ function fuzzyMatchRecursive(
if (matched) {
outScore = 100;
// Apply leading letter penalty
let penalty = LEADING_LETTER_PENALTY * matches[0];
penalty = penalty < MAX_LEADING_LETTER_PENALTY ? MAX_LEADING_LETTER_PENALTY : penalty;
outScore += penalty;
// Apply leading letter penalty (if not n8n-prefixed)
if (!target.toLowerCase().startsWith('n8n')) {
let penalty = LEADING_LETTER_PENALTY * matches[0];
penalty = penalty < MAX_LEADING_LETTER_PENALTY ? MAX_LEADING_LETTER_PENALTY : penalty;
outScore += penalty;
}
//Apply unmatched penalty
const unmatched = target.length - nextMatch;

View File

@@ -3,7 +3,7 @@
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Core Nodes"],
"alias": ["_Form", "form", "table", "submit", "post"],
"alias": ["table", "submit", "post"],
"resources": {
"primaryDocumentation": [
{