Skip to content

Commit 31f0690

Browse files
committed
Handle engagement name with the form of "proj - lang" (ignore dash)
1 parent e656750 commit 31f0690

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/components/engagement/engagement.repository.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ export const engagementFilters = filter.define(() => EngagementFilters, {
543543
relation('out', '', undefined, ACTIVE),
544544
node('match'),
545545
]),
546+
// UI joins project & language/intern names with dash
547+
// Remove it from search if users type it
548+
normalizeInput: (v) => v.replaceAll(/ -/g, ''),
546549
}),
547550
projectId: filter.pathExists((id) => [
548551
node('node'),

src/core/database/query/filters.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@ export const sub =
239239
export const fullText =
240240
({
241241
index,
242+
normalizeInput,
242243
escapeLucene = true,
243244
toLucene,
244245
minScore = 0,
245246
matchToNode,
246247
}: {
247248
index: () => FullTextIndex;
249+
normalizeInput?: (input: string) => string;
248250
escapeLucene?: boolean;
249251
toLucene?: (input: string) => string;
250252
minScore?: number;
@@ -261,6 +263,7 @@ export const fullText =
261263

262264
let input: string = value;
263265

266+
input = normalizeInput ? normalizeInput(input) : input;
264267
input = escapeLucene ? escapeLuceneSyntax(input) : input;
265268

266269
const lucene =

0 commit comments

Comments
 (0)