@Override
 public Filter nullValueFilter() {
   if (nullValue == null) {
     return null;
   }
   return NumericRangeFilter.newIntRange(
       names.indexName(), precisionStep, nullValue.intValue(), nullValue.intValue(), true, true);
 }
 @Override
 public Query fuzzyQuery(String value, String minSim, int prefixLength, int maxExpansions) {
   short iValue = Short.parseShort(value);
   short iSim;
   try {
     iSim = Short.parseShort(minSim);
   } catch (NumberFormatException e) {
     iSim = (short) Float.parseFloat(minSim);
   }
   return NumericRangeQuery.newIntRange(
       names.indexName(), precisionStep, iValue - iSim, iValue + iSim, true, true);
 }
 @Override
 public Filter rangeFilter(
     FieldDataCache fieldDataCache,
     String lowerTerm,
     String upperTerm,
     boolean includeLower,
     boolean includeUpper,
     @Nullable QueryParseContext context) {
   return NumericRangeFieldDataFilter.newShortRange(
       fieldDataCache,
       names.indexName(),
       lowerTerm == null ? null : Short.parseShort(lowerTerm),
       upperTerm == null ? null : Short.parseShort(upperTerm),
       includeLower,
       includeUpper);
 }
 @Override
 public Query fuzzyQuery(String value, double minSim, int prefixLength, int maxExpansions) {
   short iValue = Short.parseShort(value);
   short iSim = (short) (minSim * dFuzzyFactor);
   return NumericRangeQuery.newIntRange(
       names.indexName(), precisionStep, iValue - iSim, iValue + iSim, true, true);
 }
 protected ShortFieldMapper(
     Names names,
     int precisionStep,
     String fuzzyFactor,
     Field.Index index,
     Field.Store store,
     float boost,
     boolean omitNorms,
     IndexOptions indexOptions,
     Short nullValue,
     boolean ignoreMalformed) {
   super(
       names,
       precisionStep,
       fuzzyFactor,
       index,
       store,
       boost,
       omitNorms,
       indexOptions,
       ignoreMalformed,
       new NamedAnalyzer("_short/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
       new NamedAnalyzer("_short/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)));
   this.nullValue = nullValue;
   this.nullValueAsString = nullValue == null ? null : nullValue.toString();
 }
 @Override
 public String numericAsString() {
   return Short.toString(number);
 }
 @Override
 protected Fieldable innerParseCreateField(ParseContext context) throws IOException {
   short value;
   float boost = this.boost;
   if (context.externalValueSet()) {
     Object externalValue = context.externalValue();
     if (externalValue == null) {
       if (nullValue == null) {
         return null;
       }
       value = nullValue;
     } else if (externalValue instanceof String) {
       String sExternalValue = (String) externalValue;
       if (sExternalValue.length() == 0) {
         if (nullValue == null) {
           return null;
         }
         value = nullValue;
       } else {
         value = Short.parseShort(sExternalValue);
       }
     } else {
       value = ((Number) externalValue).shortValue();
     }
     if (context.includeInAll(includeInAll, this)) {
       context.allEntries().addText(names.fullName(), Short.toString(value), boost);
     }
   } else {
     XContentParser parser = context.parser();
     if (parser.currentToken() == XContentParser.Token.VALUE_NULL
         || (parser.currentToken() == XContentParser.Token.VALUE_STRING
             && parser.textLength() == 0)) {
       if (nullValue == null) {
         return null;
       }
       value = nullValue;
       if (nullValueAsString != null && (context.includeInAll(includeInAll, this))) {
         context.allEntries().addText(names.fullName(), nullValueAsString, boost);
       }
     } else if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
       XContentParser.Token token;
       String currentFieldName = null;
       Short objValue = nullValue;
       while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
         if (token == XContentParser.Token.FIELD_NAME) {
           currentFieldName = parser.currentName();
         } else {
           if ("value".equals(currentFieldName) || "_value".equals(currentFieldName)) {
             if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
               objValue = parser.shortValue();
             }
           } else if ("boost".equals(currentFieldName) || "_boost".equals(currentFieldName)) {
             boost = parser.floatValue();
           }
         }
       }
       if (objValue == null) {
         // no value
         return null;
       }
       value = objValue;
     } else {
       value = parser.shortValue();
       if (context.includeInAll(includeInAll, this)) {
         context.allEntries().addText(names.fullName(), parser.text(), boost);
       }
     }
   }
   CustomShortNumericField field = new CustomShortNumericField(this, value);
   field.setBoost(boost);
   return field;
 }
 @Override
 public String indexedValue(String value) {
   return NumericUtils.intToPrefixCoded(Short.parseShort(value));
 }
 @Override
 public Short valueFromString(String value) {
   return Short.valueOf(value);
 }