Skip to content

Commit

Permalink
Merge pull request #191 from smartprocure/feature/omit-empty-highligh…
Browse files Browse the repository at this point in the history
…t-object

Do not set empty highlights on hit if there are none
  • Loading branch information
stellarhoof authored Jan 30, 2024
2 parents cc2955c + bb72745 commit bf256a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eleven-bikes-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'contexture-elasticsearch': patch
---

Do not set empty highlights on hit if there are none.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export let searchWithHighlights = (node, search, schema) => async (body) => {
)

for (let hit of response.hits.hits) {
hit.highlight = getResponseHighlight(schema, hit, tags, nestedPathsMap)
if (hit.highlight) {
hit.highlight = getResponseHighlight(schema, hit, tags, nestedPathsMap)
}
removePathsFromSource(schema, hit, addedPaths)
mergeHighlightsOnSource(schema, hit)
}
Expand Down

0 comments on commit bf256a1

Please sign in to comment.