fix(PROJ-44): snippet + match_field in enrichedHit-Struct und JSON-Response verdrahten
Die enrichedHit-Struct in search_handlers.go fehlten die PROJ-44-Felder Snippet und MatchField, sodass die vom Index berechneten Snippets in der API-Response verworfen wurden. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -143,6 +143,8 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
|
||||
HasAttachments bool `json:"has_attachments"`
|
||||
ThreadID string `json:"thread_id,omitempty"`
|
||||
ThreadSize int `json:"thread_size,omitempty"`
|
||||
Snippet string `json:"snippet,omitempty"` // PROJ-44: HTML excerpt with <b>match</b> tags
|
||||
MatchField string `json:"match_field,omitempty"` // PROJ-44: subject|body|attachment_text|...
|
||||
}
|
||||
|
||||
// auditor role: restrict results to mails with no tenant assignment.
|
||||
@@ -180,7 +182,7 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
enriched := make([]enrichedHit, 0, len(result.Hits))
|
||||
for _, h := range result.Hits {
|
||||
eh := enrichedHit{ID: h.ID, Score: h.Score}
|
||||
eh := enrichedHit{ID: h.ID, Score: h.Score, Snippet: h.Snippet, MatchField: h.MatchField}
|
||||
if raw, err := s.store.Load(h.ID); err == nil {
|
||||
eh.Size = int64(len(raw))
|
||||
if pm, err := mailparser.Parse(raw); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user