Skip to content

Commit

Permalink
fix tool to dont push elements with empty content
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Sep 28, 2024
1 parent 75f31ad commit e70d5ac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/adjust-algolia-output/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e70d5ac

Please sign in to comment.