fix(search-backend-node): non-string field hightlight

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2023-10-08 11:22:23 +02:00
parent 2bbd05cf91
commit ad67a33d09
@@ -329,11 +329,11 @@ export function parseHighlightFields({
const highlightedField = positions.reduce((content, pos) => {
return (
`${content.substring(0, pos[0])}${preTag}` +
`${content.substring(pos[0], pos[0] + pos[1])}` +
`${postTag}${content.substring(pos[0] + pos[1])}`
`${content.toString().substring(0, pos[0])}${preTag}` +
`${content.toString().substring(pos[0], pos[0] + pos[1])}` +
`${postTag}${content.toString().substring(pos[0] + pos[1])}`
);
}, doc[field]);
}, doc[field] ?? '');
return [field, highlightedField];
}),