Skip to content

Commit

Permalink
feat: return data attribute from es search results (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsushmith authored Jan 16, 2023
1 parent 00bc9b6 commit 7df7acd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions core/asset/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ type SearchConfig struct {

// SearchResult represents an item/result in a list of search results
type SearchResult struct {
ID string `json:"id"`
URN string `json:"urn"`
Title string `json:"title"`
Type string `json:"type"`
Service string `json:"service"`
Description string `json:"description"`
Labels map[string]string `json:"labels"`
ID string `json:"id"`
URN string `json:"urn"`
Title string `json:"title"`
Type string `json:"type"`
Service string `json:"service"`
Description string `json:"description"`
Labels map[string]string `json:"labels"`
Data map[string]interface{} `json:"data"`
}

// ToAsset returns search result as asset
Expand All @@ -58,5 +59,6 @@ func (sr SearchResult) ToAsset() Asset {
Service: sr.Service,
Description: sr.Description,
Labels: sr.Labels,
Data: sr.Data,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func (repo *DiscoveryRepository) toSearchResults(hits []searchHit) []asset.Searc
Title: r.Name,
Service: r.Service,
Labels: r.Labels,
Data: r.Data,
})
}
return results
Expand Down

0 comments on commit 7df7acd

Please sign in to comment.