Search: Explain scores (#98316)

This commit is contained in:
Ryan McKinley
2025-01-06 11:25:32 -05:00
committed by GitHub
parent bfa56bcf08
commit d1d7c0850f
7 changed files with 82 additions and 51 deletions
+10
View File
@@ -343,6 +343,16 @@ func StandardSearchFields() SearchableDocumentFields {
Type: ResourceTableColumnDefinition_INT64,
Description: "created timestamp", // date?
},
{
Name: SEARCH_FIELD_EXPLAIN,
Type: ResourceTableColumnDefinition_OBJECT,
Description: "Explain why this result matches (depends on the engine)",
},
{
Name: SEARCH_FIELD_SCORE,
Type: ResourceTableColumnDefinition_DOUBLE,
Description: "The search score",
},
})
if err != nil {
panic("failed to initialize standard search fields")
+3
View File
@@ -123,6 +123,9 @@ func NewTableBuilder(cols []*ResourceTableColumnDefinition) (*TableBuilder, erro
}
var err error
for i, v := range cols {
if v == nil {
return nil, fmt.Errorf("invalid field definitions")
}
if table.lookup[v.Name] != nil {
table.hasDuplicateNames = true
continue