Neural-Brain integriert
This commit is contained in:
+10
-1
@@ -11,8 +11,10 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"kb-editor/internal/aifallback"
|
||||
"kb-editor/internal/brainactivity"
|
||||
"kb-editor/internal/staging"
|
||||
"kb-editor/internal/store"
|
||||
)
|
||||
@@ -131,8 +133,15 @@ func (a *app) handleList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (a *app) handleSearch(w http.ResponseWriter, r *http.Request) {
|
||||
startedAt := time.Now()
|
||||
q := queryFromURL(r)
|
||||
writeJSON(w, http.StatusOK, a.store.Search(q))
|
||||
result := a.store.Search(q)
|
||||
hits := make([]brainactivity.Hit, 0, len(result.Items))
|
||||
for _, hit := range result.Items {
|
||||
hits = append(hits, brainactivity.Hit{ID: hit.ID, Score: float64(hit.Score) / 100})
|
||||
}
|
||||
brainactivity.EmitSearch("knowledgebase", q.Q, hits, time.Since(startedAt))
|
||||
writeJSON(w, http.StatusOK, result)
|
||||
}
|
||||
|
||||
func (a *app) handleFacets(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user