Skip to content

Commit

Permalink
Add resolver helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Mar 4, 2022
1 parent ffec113 commit 73e75a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Foundatio.Parsers.ElasticQueries/ElasticMappingResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public ElasticMappingResolver(ITypeMapping codeMapping, Inferrer inferrer, Func<
public string GetSortFieldName(string field) {
return GetNonAnalyzedFieldName(field, ElasticMapping.SortFieldName);
}

public string GetSortFieldName(Field field) {
return GetNonAnalyzedFieldName(GetResolvedField(field), ElasticMapping.SortFieldName);
}
Expand All @@ -179,7 +179,11 @@ public ElasticMappingResolver(ITypeMapping codeMapping, Inferrer inferrer, Func<
}

public string GetAggregationsFieldName(Field field) {
return GetNonAnalyzedFieldName(GetResolvedField(field), ElasticMapping.KeywordFieldName);
return GetNonAnalyzedFieldName(field, ElasticMapping.KeywordFieldName);
}

public string GetNonAnalyzedFieldName(Field field, string preferredSubField = null) {
return GetNonAnalyzedFieldName(GetResolvedField(field), preferredSubField);
}

public string GetNonAnalyzedFieldName(string field, string preferredSubField = null) {
Expand All @@ -188,7 +192,7 @@ public ElasticMappingResolver(ITypeMapping codeMapping, Inferrer inferrer, Func<

var mapping = GetMapping(field, true);

if (mapping.Property == null || !IsPropertyAnalyzed(mapping.Property))
if (mapping?.Property == null || !IsPropertyAnalyzed(mapping.Property))
return field;

var multiFieldProperty = mapping.Property as ICoreProperty;
Expand Down

0 comments on commit 73e75a7

Please sign in to comment.