Skip to content

Commit 7df7acd

Browse files
authored
feat: return data attribute from es search results (#197)
1 parent 00bc9b6 commit 7df7acd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

core/asset/discovery.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ type SearchConfig struct {
3939

4040
// SearchResult represents an item/result in a list of search results
4141
type SearchResult struct {
42-
ID string `json:"id"`
43-
URN string `json:"urn"`
44-
Title string `json:"title"`
45-
Type string `json:"type"`
46-
Service string `json:"service"`
47-
Description string `json:"description"`
48-
Labels map[string]string `json:"labels"`
42+
ID string `json:"id"`
43+
URN string `json:"urn"`
44+
Title string `json:"title"`
45+
Type string `json:"type"`
46+
Service string `json:"service"`
47+
Description string `json:"description"`
48+
Labels map[string]string `json:"labels"`
49+
Data map[string]interface{} `json:"data"`
4950
}
5051

5152
// ToAsset returns search result as asset
@@ -58,5 +59,6 @@ func (sr SearchResult) ToAsset() Asset {
5859
Service: sr.Service,
5960
Description: sr.Description,
6061
Labels: sr.Labels,
62+
Data: sr.Data,
6163
}
6264
}

internal/store/elasticsearch/discovery_search_repository.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ func (repo *DiscoveryRepository) toSearchResults(hits []searchHit) []asset.Searc
257257
Title: r.Name,
258258
Service: r.Service,
259259
Labels: r.Labels,
260+
Data: r.Data,
260261
})
261262
}
262263
return results

0 commit comments

Comments
 (0)