diff --git a/api/internal/crawl/cmd/crawler/crawler.go b/api/internal/crawl/cmd/crawler/crawler.go index e534780d2..d87c47996 100644 --- a/api/internal/crawl/cmd/crawler/crawler.go +++ b/api/internal/crawl/cmd/crawler/crawler.go @@ -167,7 +167,7 @@ func main() { it := idx.IterateQuery(query, 10000, 60*time.Second) for it.Next() { for _, hit := range it.Value().Hits.Hits { - seedDocs = append(seedDocs, hit.Document.Copy()) + seedDocs = append(seedDocs, hit.Document.Document.Copy()) } } if err := it.Err(); err != nil { diff --git a/api/internal/crawl/doc/doc.go b/api/internal/crawl/doc/doc.go index 0e5965ac1..d37fd19ca 100644 --- a/api/internal/crawl/doc/doc.go +++ b/api/internal/crawl/doc/doc.go @@ -46,6 +46,15 @@ type KustomizationDocument struct { type set map[string]struct{} +func (doc *KustomizationDocument) Copy() *KustomizationDocument { + return &KustomizationDocument{ + Document: *(doc.Document.Copy()), + Kinds: doc.Kinds, + Identifiers: doc.Identifiers, + Values: doc.Values, + } +} + func (doc *KustomizationDocument) String() string { return fmt.Sprintf("%s %s %s %v %v %v len(identifiers):%v len(values):%v", doc.RepositoryURL, doc.FilePath, doc.DefaultBranch, doc.CreationTime,