From e70d5ac51cf4ca409c8af4d3181770f0c7c37f10 Mon Sep 17 00:00:00 2001 From: Jozef Kralik Date: Sat, 28 Sep 2024 17:55:50 +0000 Subject: [PATCH] fix tool to dont push elements with empty content --- tools/adjust-algolia-output/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/adjust-algolia-output/main.go b/tools/adjust-algolia-output/main.go index 4565030e..517b1d76 100644 --- a/tools/adjust-algolia-output/main.go +++ b/tools/adjust-algolia-output/main.go @@ -90,7 +90,13 @@ func main() { } data[idx] = item } - err = WriteTo(os.Stdout, data) + newData := make([]map[string]interface{}, 0, len(data)) + for _, item := range data { + if len(item["content"].(string)) > 0 { + newData = append(newData, item) + } + } + err = WriteTo(os.Stdout, newData) if err != nil { fmt.Fprintf(os.Stderr, "Error: %v\n", err) os.Exit(1)