From adaa1bd11b4efe17d42ec1dc5b82ebbc9b072ebe Mon Sep 17 00:00:00 2001 From: Przemyslaw Delewski <102958445+pdelewski@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:10:43 +0200 Subject: [PATCH] Get rid of FieldToColumnEncoder call (#857) This PR removes a workaround, i.e direct call to `util.FeldToColumnEncoder` and use schema to resolve internal name --- quesma/quesma/schema_map_transformation.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/quesma/quesma/schema_map_transformation.go b/quesma/quesma/schema_map_transformation.go index 8ff7a653f..ab455b209 100644 --- a/quesma/quesma/schema_map_transformation.go +++ b/quesma/quesma/schema_map_transformation.go @@ -7,7 +7,6 @@ import ( "quesma/model" "quesma/quesma/types" "quesma/schema" - "quesma/util" "strings" ) @@ -47,16 +46,19 @@ func (v *mapTypeResolver) isMap(fieldName string) (exists bool, scope searchScop scope = scopeWholeMap } - tableColumnName := util.FieldToColumnEncoder(fieldName) - col, ok := v.indexSchema.Fields[schema.FieldName(tableColumnName)] + tableColumnName, ok := v.indexSchema.ResolveField(fieldName) + if !ok { + return false, scope, fieldName + } + col, ok := v.indexSchema.Fields[schema.FieldName(tableColumnName.InternalPropertyName.AsString())] if ok { if strings.HasPrefix(col.InternalPropertyType, "Map") { - return true, scope, tableColumnName + return true, scope, tableColumnName.InternalPropertyName.AsString() } } - return false, scope, tableColumnName + return false, scope, fieldName } func existsInMap(left model.Expr, op string, mapToArrayFunction string, right model.Expr) model.Expr {