コード例 #1
0
 @Override
 public TokenStream tokenStreamValue() {
   if (isIndexed) {
     return mapper.popCachedStream().setIntValue(number);
   }
   return null;
 }
コード例 #2
0
 @Override
 public TokenStream tokenStream(Analyzer analyzer, TokenStream previous) throws IOException {
   if (fieldType().indexed()) {
     return mapper.popCachedStream().setIntValue(number);
   }
   return null;
 }
コード例 #3
0
 @Override
 public TokenStream tokenStream(Analyzer analyzer) {
   if (fieldType().indexed()) {
     return mapper.popCachedStream().setIntValue(number);
   }
   return null;
 }
コード例 #4
0
 @Override
 public TokenStream tokenStream(Analyzer analyzer, TokenStream previous) throws IOException {
   if (fieldType().indexOptions() != IndexOptions.NONE) {
     return mapper.popCachedStream().setDoubleValue(number);
   }
   return null;
 }
コード例 #5
0
 @Override
 protected void doXContentBody(XContentBuilder builder) throws IOException {
   super.doXContentBody(builder);
   if (index != Defaults.INDEX) {
     builder.field("index", index.name().toLowerCase());
   }
   if (store != Defaults.STORE) {
     builder.field("store", store.name().toLowerCase());
   }
   if (termVector != Defaults.TERM_VECTOR) {
     builder.field("term_vector", termVector.name().toLowerCase());
   }
   if (omitNorms != Defaults.OMIT_NORMS) {
     builder.field("omit_norms", omitNorms);
   }
   if (indexOptions != Defaults.INDEX_OPTIONS) {
     builder.field("index_options", indexOptionToString(indexOptions));
   }
   if (precisionStep != Defaults.PRECISION_STEP) {
     builder.field("precision_step", precisionStep);
   }
   if (fuzzyFactor != Defaults.FUZZY_FACTOR) {
     builder.field("fuzzy_factor", fuzzyFactor);
   }
   if (nullValue != null) {
     builder.field("null_value", nullValue);
   }
   if (includeInAll != null) {
     builder.field("include_in_all", includeInAll);
   }
 }
コード例 #6
0
  @Override
  protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params)
      throws IOException {
    super.doXContentBody(builder, includeDefaults, params);

    if (includeDefaults || precisionStep != Defaults.PRECISION_STEP_64_BIT) {
      builder.field("precision_step", precisionStep);
    }
    builder.field("format", dateTimeFormatter.format());
    if (includeDefaults || nullValue != null) {
      builder.field("null_value", nullValue);
    }
    if (includeInAll != null) {
      builder.field("include_in_all", includeInAll);
    } else if (includeDefaults) {
      builder.field("include_in_all", false);
    }

    if (includeDefaults || timeUnit != Defaults.TIME_UNIT) {
      builder.field("numeric_resolution", timeUnit.name().toLowerCase(Locale.ROOT));
    }
    // only serialize locale if needed, ROOT is the default, so no need to serialize that case as
    // well...
    if (dateTimeFormatter.locale() != null && dateTimeFormatter.locale() != Locale.ROOT) {
      builder.field("locale", dateTimeFormatter.locale());
    } else if (includeDefaults) {
      if (dateTimeFormatter.locale() == null) {
        builder.field("locale", Locale.ROOT);
      } else {
        builder.field("locale", dateTimeFormatter.locale());
      }
    }
  }
コード例 #7
0
    public CustomNumericField(NumberFieldMapper mapper, byte[] value) {
      this.mapper = mapper;
      this.name = mapper.names().indexName();
      fieldsData = value;

      isIndexed = mapper.indexed();
      isTokenized = mapper.indexed();
      indexOptions = FieldInfo.IndexOptions.DOCS_ONLY;
      omitNorms = mapper.omitNorms();

      if (value != null) {
        isStored = true;
        isBinary = true;
        binaryLength = value.length;
        binaryOffset = 0;
      }

      setStoreTermVector(Field.TermVector.NO);
    }
コード例 #8
0
 @Override
 public void merge(Mapper mergeWith, MergeContext mergeContext) throws MergeMappingException {
   super.merge(mergeWith, mergeContext);
   if (!this.getClass().equals(mergeWith.getClass())) {
     return;
   }
   if (!mergeContext.mergeFlags().simulate()) {
     this.nullValue = ((IpFieldMapper) mergeWith).nullValue;
   }
 }
コード例 #9
0
 @Override
 public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
   super.merge(mergeWith, mergeResult);
   if (!this.getClass().equals(mergeWith.getClass())) {
     return;
   }
   if (!mergeResult.simulate()) {
     this.fieldType = this.fieldType.clone();
     this.fieldType.setNullValue(((ShortFieldMapper) mergeWith).fieldType().nullValue());
     this.fieldType.freeze();
   }
 }
コード例 #10
0
 @Override
 protected void doXContentBody(XContentBuilder builder) throws IOException {
   super.doXContentBody(builder);
   if (precisionStep != Defaults.PRECISION_STEP) {
     builder.field("precision_step", precisionStep);
   }
   if (fuzzyFactor != Defaults.FUZZY_FACTOR) {
     builder.field("fuzzy_factor", fuzzyFactor);
   }
   if (nullValue != null) {
     builder.field("null_value", nullValue);
   }
   if (includeInAll != null) {
     builder.field("include_in_all", includeInAll);
   }
 }
コード例 #11
0
  @Override
  protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params)
      throws IOException {
    super.doXContentBody(builder, includeDefaults, params);

    if (includeDefaults || precisionStep != Defaults.PRECISION_STEP_32_BIT) {
      builder.field("precision_step", precisionStep);
    }
    if (includeDefaults || nullValue != null) {
      builder.field("null_value", nullValue);
    }
    if (includeInAll != null) {
      builder.field("include_in_all", includeInAll);
    } else if (includeDefaults) {
      builder.field("include_in_all", false);
    }
  }
コード例 #12
0
  @Override
  protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params)
      throws IOException {
    super.doXContentBody(builder, includeDefaults, params);

    if (includeDefaults || fieldType.numericPrecisionStep() != DEFAULT_PRECISION_STEP) {
      builder.field("precision_step", fieldType.numericPrecisionStep());
    }
    if (includeDefaults || fieldType().nullValue() != null) {
      builder.field("null_value", fieldType().nullValue());
    }
    if (includeInAll != null) {
      builder.field("include_in_all", includeInAll);
    } else if (includeDefaults) {
      builder.field("include_in_all", false);
    }
  }
コード例 #13
0
 public CustomShortNumericField(NumberFieldMapper mapper, short number) {
   super(mapper, mapper.stored() ? Numbers.shortToBytes(number) : null);
   this.mapper = mapper;
   this.number = number;
 }