fix(search): scope global result types

This commit is contained in:
2026-06-07 09:39:03 +08:00
parent 9027551768
commit ff2e5114a5
3 changed files with 48 additions and 7 deletions
@@ -15,6 +15,13 @@ import (
const chatwootSearchPerPage = 15
var chatwootGlobalSearchTypes = []search.SearchResultType{
search.ResultTypeConversation,
search.ResultTypeContact,
search.ResultTypeMessage,
search.ResultTypeArticle,
}
// SearchHandler handles global search API endpoints.
// Reference: Chatwoot GlobalSearchService — cross-entity search with advanced filtering.
type SearchHandler struct {
@@ -79,6 +86,7 @@ func (h *SearchHandler) GlobalSearch(c *gin.Context) {
query := c.Query("q")
filter := parseChatwootSearchFilter(c)
filter.Types = append([]search.SearchResultType(nil), chatwootGlobalSearchTypes...)
result, svcErr := h.svc.GlobalSearch(c.Request.Context(), accountID, query, &filter)
if svcErr != nil {