From dd68300ab22f77e97102ea36f87237a15ef8ef7d Mon Sep 17 00:00:00 2001 From: liugq Date: Thu, 20 Apr 2023 10:49:24 +0800 Subject: [PATCH] layout search support filtering with param is_fixed --- plugin/api/layout/layout.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/api/layout/layout.go b/plugin/api/layout/layout.go index 0f025eff..4c127102 100644 --- a/plugin/api/layout/layout.go +++ b/plugin/api/layout/layout.go @@ -152,8 +152,21 @@ func (h *LayoutAPI) searchLayout(w http.ResponseWriter, req *http.Request, ps ht strFrom = h.GetParameterOrDefault(req, "from", "0") viewID = strings.TrimSpace(h.GetParameterOrDefault(req, "view_id", "")) typ = strings.TrimSpace(h.GetParameterOrDefault(req, "type", "")) + isFixed = strings.TrimSpace(h.GetParameterOrDefault(req, "is_fixed", "")) mustQ []util.MapStr ) + if isFixed != "" { + fixed, err := strconv.ParseBool(isFixed) + if err == nil { + mustQ = append(mustQ, util.MapStr{ + "term": util.MapStr{ + "is_fixed": util.MapStr{ + "value": fixed, + }, + }, + }) + } + } if viewID != "" { mustQ = append(mustQ, util.MapStr{ "term": util.MapStr{