mirror of
https://github.com/docmost/docmost.git
synced 2026-09-01 03:15:32 +08:00
typesense support
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user