From 74e154b130bf6018659b17bf7688ff62d4269368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 5 Aug 2024 17:52:46 +0200 Subject: [PATCH] refactor(editor): Boost n8n Form Trigger in nodes-panel search results (#10294) --- packages/editor-ui/src/utils/sortUtils.ts | 10 ++++++---- packages/nodes-base/nodes/Form/FormTrigger.node.json | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/src/utils/sortUtils.ts b/packages/editor-ui/src/utils/sortUtils.ts index 7dbc780634..3d92d7a5e1 100644 --- a/packages/editor-ui/src/utils/sortUtils.ts +++ b/packages/editor-ui/src/utils/sortUtils.ts @@ -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; diff --git a/packages/nodes-base/nodes/Form/FormTrigger.node.json b/packages/nodes-base/nodes/Form/FormTrigger.node.json index 8fb0763a34..6531f1e8c6 100644 --- a/packages/nodes-base/nodes/Form/FormTrigger.node.json +++ b/packages/nodes-base/nodes/Form/FormTrigger.node.json @@ -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": [ {