unistore: index search references (#106954)
This commit is contained in:
@@ -103,7 +103,10 @@ type IndexableDocument struct {
|
||||
|
||||
// Maintain a list of resource references.
|
||||
// Someday this will likely be part of https://github.com/grafana/gamma
|
||||
References ResourceReferences `json:"reference,omitempty"`
|
||||
References ResourceReferences `json:"references,omitempty"`
|
||||
|
||||
// internal field for mapping references to kind ( don't set this directly )
|
||||
Reference map[string][]string `json:"reference,omitempty"` // map of kind to list of names
|
||||
|
||||
// When the resource is managed by an upstream repository
|
||||
Manager *utils.ManagerProperties `json:"manager,omitempty"`
|
||||
@@ -121,6 +124,12 @@ func (m *IndexableDocument) UpdateCopyFields() *IndexableDocument {
|
||||
if m.Manager != nil {
|
||||
m.ManagedBy = fmt.Sprintf("%s:%s", m.Manager.Kind, m.Manager.Identity)
|
||||
}
|
||||
|
||||
m.Reference = make(map[string][]string)
|
||||
for _, ref := range m.References {
|
||||
// Group and Version are ignored for now. This could be revisited.
|
||||
m.Reference[ref.Kind] = append(m.Reference[ref.Kind], ref.Name)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user