Skip to content

Commit

Permalink
Add spelling correction to included search page
Browse files Browse the repository at this point in the history
  • Loading branch information
FluxCapacitor2 committed Jan 1, 2025
1 parent 86ce688 commit decfd8c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,15 @@ func renderTemplateWithResults(db database.Database, config *config.Config, req
if len(src) > 0 && len(q) > 0 && err == nil {
var err error
start := time.Now().UnixMicro()
results, total, err = db.Search(req.Context(), src, q, uint32(page), 10)

spellchecked, err := db.Spellfix(req.Context(), q)
if err != nil {
slogctx.Error(req.Context(), "Error correcting query spelling", "error", err)
w.WriteHeader(500)
w.Write([]byte("Internal server error"))
return
}
results, total, err = db.Search(req.Context(), src, spellchecked, uint32(page), 10)
end := time.Now().UnixMicro()

totalTime = end - start
Expand Down

0 comments on commit decfd8c

Please sign in to comment.