unistore: index search references (#106954)

This commit is contained in:
Georges Chaudy
2025-06-24 14:54:07 -05:00
committed by GitHub
parent 74ce09011e
commit 5150ebfba8
5 changed files with 112 additions and 4 deletions
+10 -1
View File
@@ -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
}