jump to search init

This commit is contained in:
Salihu
2026-08-28 23:05:14 +01:00
parent cd9c166927
commit 70c8c6cfda
8 changed files with 101 additions and 11 deletions
@@ -8,6 +8,7 @@ export class SearchResponseDto {
creatorId: string;
rank: number;
highlight: string;
matchedText?: string;
createdAt: Date;
updatedAt: Date;
space: Partial<Space>;
@@ -144,6 +144,11 @@ export class SearchService {
result.highlight = result.highlight
.replace(/\r\n|\r|\n/g, ' ')
.replace(/\s+/g, ' ');
const matchedText = result.highlight.match(/<b>([^<]*)<\/b>/i);
result.matchedText = matchedText?.[1] ?? null;
} else {
result.matchedText = null;
}
return result;
});