typesense support

This commit is contained in:
Salihu
2026-08-30 00:12:48 +01:00
parent 435c4d3129
commit 1b73d7668c
7 changed files with 46 additions and 48 deletions
@@ -8,7 +8,8 @@ export class SearchResponseDto {
creatorId: string;
rank: number;
highlight: string;
matchedText?: string[];
matchedText: string[];
wholeWord: boolean;
createdAt: Date;
updatedAt: Date;
space: Partial<Space>;
@@ -149,11 +149,16 @@ export class SearchService {
.replace(/\r\n|\r|\n/g, ' ')
.replace(/\s+/g, ' ');
result.matchedText = Array.from(
result.highlight.matchAll(/<b>([^<]*)<\/b>/gi),
(match) => match[1],
);
result.matchedText = [
...new Set(
Array.from(
result.highlight.matchAll(/<b>([^<]*)<\/b>/gi),
(match) => match[1],
),
),
];
result.wholeWord = true
return result;
});