fix(search): scope global result types
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user