Skip to content

Commit

Permalink
Get rid of FieldToColumnEncoder call (#857)
Browse files Browse the repository at this point in the history
This PR removes a workaround, i.e direct call to
`util.FeldToColumnEncoder` and use schema to resolve internal name
  • Loading branch information
pdelewski authored Oct 8, 2024
1 parent 22928bd commit adaa1bd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions quesma/quesma/schema_map_transformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"quesma/model"
"quesma/quesma/types"
"quesma/schema"
"quesma/util"
"strings"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit adaa1bd

Please sign in to comment.