Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit b08b3b2

Browse files
authored
Multiple schema resolve - speed up (#1179)
We can speed up the process of resolving multiple schemas more simply. No cache is required now.
1 parent 364add6 commit b08b3b2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

quesma/quesma/functionality/field_capabilities/field_caps.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,15 @@ func addFieldCapabilityFromSchemaRegistry(fields map[string]map[string]model.Fie
4444

4545
func handleFieldCapsIndex(cfg map[string]config.IndexConfiguration, schemaRegistry schema.Registry, indexes []string) ([]byte, error) {
4646
fields := make(map[string]map[string]model.FieldCapability)
47+
48+
schemas := schemaRegistry.AllSchemas()
49+
4750
for _, resolvedIndex := range indexes {
4851
if len(resolvedIndex) == 0 {
4952
continue
5053
}
5154

52-
if schemaDefinition, found := schemaRegistry.FindSchema(schema.IndexName(resolvedIndex)); found {
55+
if schemaDefinition, found := schemas[schema.IndexName(resolvedIndex)]; found {
5356
indexConfig, configured := cfg[resolvedIndex]
5457
if configured && !indexConfig.IsClickhouseQueryEnabled() {
5558
continue

quesma/quesma/search.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,10 @@ func (q *QueryRunner) handleSearchCommon(ctx context.Context, indexPattern strin
533533
DatabaseName: "", // it doesn't matter here, common table will be used
534534
}
535535

536+
schemas := q.schemaRegistry.AllSchemas()
537+
536538
for _, idx := range resolvedIndexes {
537-
scm, ok := q.schemaRegistry.FindSchema(schema.IndexName(idx))
539+
scm, ok := schemas[schema.IndexName(idx)]
538540
if !ok {
539541
return []byte{}, end_user_errors.ErrNoSuchTable.New(fmt.Errorf("can't load %s schema", idx)).Details("Table: %s", idx)
540542
}

0 commit comments

Comments
 (0)