@SuppressWarnings("unchecked") private <IFD> IFD getFieldData(final String facetName, final String fieldName, final SearchContext context) { if(fieldName != null) { final FieldMapper<?> mapper = context.smartNameFieldMapper(fieldName); if(mapper == null) { throw new FacetPhaseExecutionException(facetName, "no mapping found for " + fieldName); } // This cast is a workaround to deal with issue #41 return (IFD) context.fieldData().getForField(mapper); } return null; }
private LongArrayIndexFieldData getKeyFieldData(final String facetName, final String fieldName, final SearchContext context) { if(fieldName != null) { final FieldMapper<?> mapper = context.smartNameFieldMapper(fieldName); if(mapper == null) { throw new FacetPhaseExecutionException(facetName, "no mapping found for " + fieldName); } if(!"long".equals(mapper.fieldDataType().getType())) { throw new FacetPhaseExecutionException(facetName, "key field " + fieldName + " is not of type long"); } return context.fieldData().getForField(mapper); } else throw new FacetPhaseExecutionException(facetName, "[key_field] is required to be set for date facet"); }
final FieldMapper<?> mapper = context.smartNameFieldMapper(keyField); if(mapper == null) { throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] not found");
final FieldMapper mapper = context.smartNameFieldMapper(field); if (mapper == null) { logger.warn("No mapping found for Field : {} ", field);
throw new FacetPhaseExecutionException(facetName, "value [" + factor + "] is not in range [0.0, 1.0]"); FieldMapper<?> fieldMapper = context.smartNameFieldMapper(fieldName); if (fieldMapper == null) { throw new FacetPhaseExecutionException(facetName, "failed to find mapping for [" + fieldName + "]");
FieldMapper mapper = context.smartNameFieldMapper(keyField); if (mapper == null) { throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] not found");
throw new FacetPhaseExecutionException(facetName, "key field is required to be set for distinct histogram facet, either using [field] or using [key_field]"); FieldMapper keyMapper = context.smartNameFieldMapper(keyField); if (keyMapper == null) { throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] not found"); throw new FacetPhaseExecutionException(facetName, "distinct field is required to be set for distinct histogram facet, either using [value_field] or using [distinctField]"); FieldMapper distinctFieldMapper = context.smartNameFieldMapper(distinctField); if (distinctFieldMapper == null) { throw new FacetPhaseExecutionException(facetName, "no mapping found for " + distinctField);
FieldMapper<?> mapper = context.smartNameFieldMapper(field); if (mapper == null) { config.unmapped(true);