public final class QueryParserHelper
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static FieldMapper |
getFieldMapper(MapperService mapperService,
java.lang.String field) |
Get a
FieldMapper associated with a field name or null. |
static java.util.Map<java.lang.String,java.lang.Float> |
parseFieldsAndWeights(java.util.List<java.lang.String> fields) |
Convert a list of field names encoded with optional boosts to a map that associates
the field name and its boost.
|
static java.util.Map<java.lang.String,java.lang.Float> |
resolveMappingField(QueryShardContext context,
java.lang.String fieldOrPattern,
float weight,
boolean acceptAllTypes,
boolean acceptMetadataField) |
Resolves the provided pattern or field name from the
QueryShardContext and return a map of
the expanded fields with their original boost. |
static java.util.Map<java.lang.String,java.lang.Float> |
resolveMappingField(QueryShardContext context,
java.lang.String fieldOrPattern,
float weight,
boolean acceptAllTypes,
boolean acceptMetadataField,
java.lang.String fieldSuffix) |
Resolves the provided pattern or field name from the
QueryShardContext and return a map of
the expanded fields with their original boost. |
static java.util.Map<java.lang.String,java.lang.Float> |
resolveMappingFields(QueryShardContext context,
java.util.Map<java.lang.String,java.lang.Float> fieldsAndWeights) |
|
static java.util.Map<java.lang.String,java.lang.Float> |
resolveMappingFields(QueryShardContext context,
java.util.Map<java.lang.String,java.lang.Float> fieldsAndWeights,
java.lang.String fieldSuffix) |
Resolve all the field names and patterns present in the provided map with the
QueryShardContext and returns a new map containing all the expanded fields with their original boost. |
public static java.util.Map<java.lang.String,java.lang.Float> parseFieldsAndWeights(java.util.List<java.lang.String> fields)
fields
- The list of fields encoded with optional boosts (e.g. ^0.35).public static FieldMapper getFieldMapper(MapperService mapperService, java.lang.String field)
FieldMapper
associated with a field name or null.mapperService
- The mapper service where to find the mapping.field
- The field name to search.public static java.util.Map<java.lang.String,java.lang.Float> resolveMappingFields(QueryShardContext context, java.util.Map<java.lang.String,java.lang.Float> fieldsAndWeights)
public static java.util.Map<java.lang.String,java.lang.Float> resolveMappingFields(QueryShardContext context, java.util.Map<java.lang.String,java.lang.Float> fieldsAndWeights, java.lang.String fieldSuffix)
QueryShardContext
and returns a new map containing all the expanded fields with their original boost.context
- The context of the query.fieldsAndWeights
- The map of fields and weights to expand.fieldSuffix
- The suffix name to add to the expanded field names if a mapping exists for that name.
The original name of the field is kept if adding the suffix to the field name does not point to a valid field
in the mapping.public static java.util.Map<java.lang.String,java.lang.Float> resolveMappingField(QueryShardContext context, java.lang.String fieldOrPattern, float weight, boolean acceptAllTypes, boolean acceptMetadataField)
QueryShardContext
and return a map of
the expanded fields with their original boost.context
- The context of the queryfieldOrPattern
- The field name or the pattern to resolveweight
- The weight for the fieldacceptAllTypes
- Whether all field type should be added when a pattern is expanded.
If false, only ALLOWED_QUERY_MAPPER_TYPES
are accepted and other field types
are discarded from the query.acceptMetadataField
- Whether metadata fields should be added when a pattern is expanded.public static java.util.Map<java.lang.String,java.lang.Float> resolveMappingField(QueryShardContext context, java.lang.String fieldOrPattern, float weight, boolean acceptAllTypes, boolean acceptMetadataField, java.lang.String fieldSuffix)
QueryShardContext
and return a map of
the expanded fields with their original boost.context
- The context of the queryfieldOrPattern
- The field name or the pattern to resolveweight
- The weight for the fieldacceptAllTypes
- Whether all field type should be added when a pattern is expanded.
If false, only ALLOWED_QUERY_MAPPER_TYPES
are accepted and other field types
are discarded from the query.acceptMetadataField
- Whether metadata fields should be added when a pattern is expanded.fieldSuffix
- The suffix name to add to the expanded field names if a mapping exists for that name.
The original name of the field is kept if adding the suffix to the field name does not point to a valid field
in the mapping.