From a7874d063ed02659e07c1e7d9a6f442bc9b4e199 Mon Sep 17 00:00:00 2001 From: Oliver Eilhard Date: Wed, 16 Jun 2021 11:23:35 +0200 Subject: [PATCH] Fix to improve search result collection --- CONTRIBUTORS | 1 + search.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 5e0ee666..b3d265c1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -32,6 +32,7 @@ arthurgustin [@arthurgustin](https://github.com/arthurgustin) Bas van Dijk [@basvandijk](https://github.com/basvandijk) Benjamin Fernandes [@LotharSee](https://github.com/LotharSee) Benjamin Zarzycki [@kf6nux](https://github.com/kf6nux) +bestgopher [@bestgopher](https://github.com/bestgopher) Björn Gerdau [@kernle32dll](https://github.com/kernle32dll) Boris Popovschi [@Zyqsempai](https://github.com/Zyqsempai) Bowei Xu [@vancexu](https://github.com/vancexu) diff --git a/search.go b/search.go index f47fdf5c..6e0b476a 100644 --- a/search.go +++ b/search.go @@ -691,7 +691,7 @@ func (r *SearchResult) Each(typ reflect.Type) []interface{} { if r.Hits == nil || r.Hits.Hits == nil || len(r.Hits.Hits) == 0 { return nil } - var slice []interface{} + slice := make([]interface{}, 0, len(r.Hits.Hits)) for _, hit := range r.Hits.Hits { v := reflect.New(typ).Elem() if hit.Source == nil {