EntityAPI: Rename references from kind to family (#62044)

This commit is contained in:
Ryan McKinley
2023-01-25 23:42:04 +00:00
committed by GitHub
parent f3aa058886
commit 46c828c2d8
16 changed files with 256 additions and 250 deletions
+12 -12
View File
@@ -170,15 +170,15 @@ func getNonFolderDashboardDoc(dash dashboard, location string) *bluge.Document {
}
for _, ref := range dash.summary.References {
if ref.Kind == entity.StandardKindDataSource {
if ref.Family == entity.StandardKindDataSource {
if ref.Type != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
StoreValue().
Aggregatable().
SearchTermPositions())
}
if ref.UID != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.UID).
if ref.Identifier != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.Identifier).
StoreValue().
Aggregatable().
SearchTermPositions())
@@ -194,8 +194,8 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
var docs []*bluge.Document
for _, panel := range dash.summary.Nested {
if panel.Kind == "panel-row" {
continue // for now, we are excluding rows from the search index
if panel.Fields["type"] == "row" {
continue // skip rows
}
idx := strings.LastIndex(panel.UID, "#")
panelId, err := strconv.Atoi(panel.UID[idx+1:])
@@ -209,7 +209,7 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
AddField(bluge.NewKeywordField(documentFieldKind, string(entityKindPanel)).Aggregatable().StoreValue()) // likely want independent index for this
for _, ref := range dash.summary.References {
switch ref.Kind {
switch ref.Family {
case entity.StandardKindDashboard:
if ref.Type != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSType, ref.Type).
@@ -217,19 +217,19 @@ func getDashboardPanelDocs(dash dashboard, location string) []*bluge.Document {
Aggregatable().
SearchTermPositions())
}
if ref.UID != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.UID).
if ref.Identifier != "" {
doc.AddField(bluge.NewKeywordField(documentFieldDSUID, ref.Identifier).
StoreValue().
Aggregatable().
SearchTermPositions())
}
case entity.ExternalEntityReferencePlugin:
if ref.Type == entity.StandardKindPanel && ref.UID != "" {
doc.AddField(bluge.NewKeywordField(documentFieldPanelType, ref.UID).Aggregatable().StoreValue())
if ref.Type == entity.StandardKindPanel && ref.Identifier != "" {
doc.AddField(bluge.NewKeywordField(documentFieldPanelType, ref.Identifier).Aggregatable().StoreValue())
}
case entity.ExternalEntityReferenceRuntime:
if ref.Type == entity.ExternalEntityReferenceRuntime_Transformer && ref.UID != "" {
doc.AddField(bluge.NewKeywordField(documentFieldTransformer, ref.UID).Aggregatable())
if ref.Type == entity.ExternalEntityReferenceRuntime_Transformer && ref.Identifier != "" {
doc.AddField(bluge.NewKeywordField(documentFieldTransformer, ref.Identifier).Aggregatable())
}
}
}