Skip to content

Commit

Permalink
Fixed crash with highlights and new index
Browse files Browse the repository at this point in the history
  • Loading branch information
svera authored Jan 21, 2024
1 parent bee6c6a commit 60e555b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/webserver/controller/document/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ func (d *Controller) Search(c *fiber.Ctx) error {

docsSortedByHighlightedDate := make([]index.Document, len(docs))
for i, path := range highlights.Hits() {
docsSortedByHighlightedDate[i] = docs[path]
docsSortedByHighlightedDate[i].Highlighted = true
if doc, ok := docs[path]; ok {
docsSortedByHighlightedDate[i] = doc
docsSortedByHighlightedDate[i].Highlighted = true
}
}

return c.Render("index", fiber.Map{
Expand Down

0 comments on commit 60e555b

Please sign in to comment.