Skip to content

Commit 0345dc7

Browse files
bors[bot]bidoubiwa
andauthored
Merge #403
403: Avoid snippeting on empty string r=bidoubiwa a=bidoubiwa Fixes: #371 Fixes: #404 Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents 6667133 + 5f4c104 commit 0345dc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/adapter/to-instantsearch-highlight.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const snippetValue: SnippetValue = (
5353
let newValue = value
5454
// manage a kind of `...` for the crop until this issue is solved: https://github.com/meilisearch/MeiliSearch/issues/923
5555
// `...` is put if we are at the middle of a sentence (instead at the middle of the document field)
56-
if (snippetEllipsisText !== undefined && isString(newValue)) {
56+
if (snippetEllipsisText !== undefined && isString(newValue) && newValue) {
5757
if (
5858
newValue[0] === newValue[0].toLowerCase() && // beginning of a sentence
5959
newValue.startsWith('<em>') === false // beginning of the document field, otherwise MeiliSearch would crop around the highligh

0 commit comments

Comments
 (0)