• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IndexNumericFieldData类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.elasticsearch.index.fielddata.IndexNumericFieldData的典型用法代码示例。如果您正苦于以下问题:Java IndexNumericFieldData类的具体用法?Java IndexNumericFieldData怎么用?Java IndexNumericFieldData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IndexNumericFieldData类属于org.elasticsearch.index.fielddata包,在下文中一共展示了IndexNumericFieldData类的31个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCase

点赞 3

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private void testCase(IndexSearcher indexSearcher, MappedFieldType genreFieldType, String executionHint,
                      Consumer<InternalSampler> verify) throws IOException {
    MappedFieldType idFieldType = new KeywordFieldMapper.KeywordFieldType();
    idFieldType.setName("id");
    idFieldType.setHasDocValues(true);

    SortedNumericDVIndexFieldData fieldData = new SortedNumericDVIndexFieldData(new Index("index", "index"), "price",
            IndexNumericFieldData.NumericType.DOUBLE);
    FunctionScoreQuery query = new FunctionScoreQuery(new MatchAllDocsQuery(),
            new FieldValueFactorFunction("price", 1, FieldValueFactorFunction.Modifier.RECIPROCAL, null, fieldData));

    DiversifiedAggregationBuilder builder = new DiversifiedAggregationBuilder("_name")
            .field(genreFieldType.name())
            .executionHint(executionHint)
            .subAggregation(new TermsAggregationBuilder("terms", null).field("id"));

    InternalSampler result = search(indexSearcher, query, builder, genreFieldType, idFieldType);
    verify.accept(result);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:20,
代码来源:DiversifiedSamplerTests.java

示例2: get

点赞 3

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
/**
 * Instantiates a new reusable {@link BytesRefTermStream} based on the field type.
 */
public static BytesRefTermStream get(IndexReader reader, IndexFieldData indexFieldData) {
  if (indexFieldData instanceof IndexNumericFieldData) {
    IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData;
    switch (numFieldData.getNumericType()) {

      case INT:
        return new IntegerBytesRefTermStream(reader, numFieldData);

      case LONG:
        return new LongBytesRefTermStream(reader, numFieldData);

      default:
        throw new UnsupportedOperationException("Streaming numeric type '" + numFieldData.getNumericType().name() + "' is unsupported");

    }
  }
  else {
    return new BytesBytesRefTermStream(reader, indexFieldData);
  }
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:24,
代码来源:BytesRefTermStream.java

示例3: numericField

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private ValuesSource.Numeric numericField() throws IOException {

        if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) {
            throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() +
                    "], but got [" + fieldContext().fieldType().typeName() + "]");
        }

        ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData());
        if (script() != null) {
            dataSource = new ValuesSource.Numeric.WithScript(dataSource, script());
        }
        return dataSource;
    }
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:14,
代码来源:ValuesSourceConfig.java

示例4: build

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
public SortFieldAndFormat build(QueryShardContext context) throws IOException {
    if (DOC_FIELD_NAME.equals(fieldName)) {
        if (order == SortOrder.DESC) {
            return SORT_DOC_REVERSE;
        } else {
            return SORT_DOC;
        }
    } else {
        MappedFieldType fieldType = context.fieldMapper(fieldName);
        if (fieldType == null) {
            if (unmappedType != null) {
                fieldType = context.getMapperService().unmappedFieldType(unmappedType);
            } else {
                throw new QueryShardException(context, "No mapping found for [" + fieldName + "] in order to sort on");
            }
        }

        MultiValueMode localSortMode = null;
        if (sortMode != null) {
            localSortMode = MultiValueMode.fromString(sortMode.toString());
        }

        boolean reverse = (order == SortOrder.DESC);
        if (localSortMode == null) {
            localSortMode = reverse ? MultiValueMode.MAX : MultiValueMode.MIN;
        }

        final Nested nested = resolveNested(context, nestedPath, nestedFilter);
        IndexFieldData<?> fieldData = context.getForField(fieldType);
        if (fieldData instanceof IndexNumericFieldData == false
                && (sortMode == SortMode.SUM || sortMode == SortMode.AVG || sortMode == SortMode.MEDIAN)) {
            throw new QueryShardException(context, "we only support AVG, MEDIAN and SUM on number based fields");
        }
        IndexFieldData.XFieldComparatorSource fieldComparatorSource = fieldData
                .comparatorSource(missing, localSortMode, nested);
        SortField field = new SortField(fieldType.name(), fieldComparatorSource, reverse);
        return new SortFieldAndFormat(field, fieldType.docValueFormat(null, null));
    }
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:41,
代码来源:FieldSortBuilder.java

示例5: doToFunction

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
protected ScoreFunction doToFunction(QueryShardContext context) {
    MappedFieldType fieldType = context.getMapperService().fullName(field);
    IndexNumericFieldData fieldData = null;
    if (fieldType == null) {
        if(missing == null) {
            throw new ElasticsearchException("Unable to find a field mapper for field [" + field + "]. No 'missing' value defined.");
        }
    } else {
        fieldData = context.getForField(fieldType);
    }
    return new FieldValueFactorFunction(field, factor, modifier, missing, fieldData);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:14,
代码来源:FieldValueFactorFunctionBuilder.java

示例6: parseNumberVariable

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private AbstractDistanceScoreFunction parseNumberVariable(XContentParser parser, QueryShardContext context,
        MappedFieldType fieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    double scale = 0;
    double origin = 0;
    double decay = 0.5;
    double offset = 0.0d;
    boolean scaleFound = false;
    boolean refFound = false;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (DecayFunctionBuilder.SCALE.equals(parameterName)) {
            scale = parser.doubleValue();
            scaleFound = true;
        } else if (DecayFunctionBuilder.DECAY.equals(parameterName)) {
            decay = parser.doubleValue();
        } else if (DecayFunctionBuilder.ORIGIN.equals(parameterName)) {
            origin = parser.doubleValue();
            refFound = true;
        } else if (DecayFunctionBuilder.OFFSET.equals(parameterName)) {
            offset = parser.doubleValue();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    if (!scaleFound || !refFound) {
        throw new ElasticsearchParseException("both [{}] and [{}] must be set for numeric fields.", DecayFunctionBuilder.SCALE,
                DecayFunctionBuilder.ORIGIN);
    }
    IndexNumericFieldData numericFieldData = context.getForField(fieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:35,
代码来源:DecayFunctionBuilder.java

示例7: fielddataBuilder

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
public IndexFieldData.Builder fielddataBuilder() {
    failIfNoDocValues();
    return new IndexFieldData.Builder() {
        @Override
        public IndexFieldData<?> build(IndexSettings indexSettings, MappedFieldType fieldType, IndexFieldDataCache cache,
                CircuitBreakerService breakerService, MapperService mapperService) {
            final IndexNumericFieldData scaledValues = (IndexNumericFieldData) new DocValuesIndexFieldData.Builder()
                    .numericType(IndexNumericFieldData.NumericType.LONG)
                    .build(indexSettings, fieldType, cache, breakerService, mapperService);
            return new ScaledFloatIndexFieldData(scaledValues, scalingFactor);
        }
    };
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:15,
代码来源:ScaledFloatFieldMapper.java

示例8: FieldValueFactorFunction

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public FieldValueFactorFunction(String field, float boostFactor, Modifier modifierType, Double missing,
        IndexNumericFieldData indexFieldData) {
    super(CombineFunction.MULTIPLY);
    this.field = field;
    this.boostFactor = boostFactor;
    this.modifier = modifierType;
    this.indexFieldData = indexFieldData;
    this.missing = missing;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:10,
代码来源:FieldValueFactorFunction.java

示例9: numericField

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private ValuesSource.Numeric numericField(ValuesSourceConfig<?> config) throws IOException {

        if (!(config.fieldContext.indexFieldData() instanceof IndexNumericFieldData)) {
            throw new IllegalArgumentException("Expected numeric type on field [" + config.fieldContext.field() +
                    "], but got [" + config.fieldContext.fieldType().typeName() + "]");
        }

        ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData) config.fieldContext.indexFieldData());
        if (config.script != null) {
            dataSource = new ValuesSource.Numeric.WithScript(dataSource, config.script);
        }
        return dataSource;
    }
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:14,
代码来源:AggregationContext.java

示例10: parseNumberVariable

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private AbstractDistanceScoreFunction parseNumberVariable(String fieldName, XContentParser parser, QueryParseContext parseContext,
        NumberFieldMapper.NumberFieldType fieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    double scale = 0;
    double origin = 0;
    double decay = 0.5;
    double offset = 0.0d;
    boolean scaleFound = false;
    boolean refFound = false;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (parameterName.equals(DecayFunctionBuilder.SCALE)) {
            scale = parser.doubleValue();
            scaleFound = true;
        } else if (parameterName.equals(DecayFunctionBuilder.DECAY)) {
            decay = parser.doubleValue();
        } else if (parameterName.equals(DecayFunctionBuilder.ORIGIN)) {
            origin = parser.doubleValue();
            refFound = true;
        } else if (parameterName.equals(DecayFunctionBuilder.OFFSET)) {
            offset = parser.doubleValue();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    if (!scaleFound || !refFound) {
        throw new ElasticsearchParseException("both [{}] and [{}] must be set for numeric fields.", DecayFunctionBuilder.SCALE, DecayFunctionBuilder.ORIGIN);
    }
    IndexNumericFieldData numericFieldData = parseContext.getForField(fieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:34,
代码来源:DecayFunctionParser.java

示例11: parseDateVariable

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private AbstractDistanceScoreFunction parseDateVariable(String fieldName, XContentParser parser, QueryParseContext parseContext,
        DateFieldMapper.DateFieldType dateFieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    String scaleString = null;
    String originString = null;
    String offsetString = "0d";
    double decay = 0.5;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (parameterName.equals(DecayFunctionBuilder.SCALE)) {
            scaleString = parser.text();
        } else if (parameterName.equals(DecayFunctionBuilder.ORIGIN)) {
            originString = parser.text();
        } else if (parameterName.equals(DecayFunctionBuilder.DECAY)) {
            decay = parser.doubleValue();
        } else if (parameterName.equals(DecayFunctionBuilder.OFFSET)) {
            offsetString = parser.text();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    long origin = SearchContext.current().nowInMillis();
    if (originString != null) {
        origin = dateFieldType.parseToMilliseconds(originString, false, null, null);
    }

    if (scaleString == null) {
        throw new ElasticsearchParseException("[{}] must be set for date fields.", DecayFunctionBuilder.SCALE);
    }
    TimeValue val = TimeValue.parseTimeValue(scaleString, TimeValue.timeValueHours(24), getClass().getSimpleName() + ".scale");
    double scale = val.getMillis();
    val = TimeValue.parseTimeValue(offsetString, TimeValue.timeValueHours(24), getClass().getSimpleName() + ".offset");
    double offset = val.getMillis();
    IndexNumericFieldData numericFieldData = parseContext.getForField(dateFieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:39,
代码来源:DecayFunctionParser.java

示例12: FieldValueFactorFunction

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public FieldValueFactorFunction(String field, float boostFactor, Modifier modifierType, Double missing,
        IndexNumericFieldData indexFieldData) {
    super(CombineFunction.MULT);
    this.field = field;
    this.boostFactor = boostFactor;
    this.modifier = modifierType;
    this.indexFieldData = indexFieldData;
    this.missing = missing;
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:10,
代码来源:FieldValueFactorFunction.java

示例13: getDocIdSet

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
public DocIdSet getDocIdSet(LeafReaderContext context) throws IOException {
  final NumericTermsSet termsSet = this.getTermsSet();

  // make sure there are terms to filter on
  if (termsSet == null || termsSet.isEmpty()) return null;

  IndexNumericFieldData numericFieldData = (IndexNumericFieldData) fieldData;
  if (!numericFieldData.getNumericType().isFloatingPoint()) {
    final SortedNumericDocValues values = numericFieldData.load(context).getLongValues(); // load fielddata
    return new DocValuesDocIdSet(context.reader().maxDoc(), context.reader().getLiveDocs()) {
      @Override
      protected boolean matchDoc(int doc) {
        values.setDocument(doc);
        final int numVals = values.count();
        for (int i = 0; i < numVals; i++) {
          if (termsSet.contains(values.valueAt(i))) {
            return true;
          }
        }

        return false;
      }
    };
  }

  // only get here if wrong fielddata type in which case
  // no docs will match so we just return null.
  return null;
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:31,
代码来源:FieldDataTermsQuery.java

示例14: toFieldDataTermsQuery

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private final Query toFieldDataTermsQuery(MappedFieldType fieldType, IndexFieldData fieldData,
                                          byte[] encodedTerms, long cacheKey) {
  Query query = null;

  if (fieldType instanceof NumberFieldMapper.NumberFieldType) {
    query = FieldDataTermsQuery.newLongs(encodedTerms, (IndexNumericFieldData) fieldData, cacheKey);
  } else if (fieldType instanceof StringFieldMapper.StringFieldType) {
    query = FieldDataTermsQuery.newBytes(encodedTerms, fieldData, cacheKey);
  } else {
    throw new ElasticsearchParseException("[fielddata_terms] query does not support field data type " + fieldType.fieldDataType().getType());
  }

  return query;
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:15,
代码来源:FieldDataTermsQueryParser.java

示例15: set

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
protected void set(int atomicReaderId, int atomicDocId) {
  // loading values from field data cache is costly,
  // therefore we load values from cache only if new atomic reader id
  if (lastAtomicReaderId != atomicReaderId) {
    LeafReaderContext leafReader = reader.leaves().get(atomicReaderId);
    this.values = ((IndexNumericFieldData) this.fieldData).load(leafReader).getLongValues();
  }
  this.values.setDocument(atomicDocId);
  this.count = 0;
  this.lastAtomicReaderId = atomicReaderId;
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:13,
代码来源:BytesRefTermStream.java

示例16: get

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
/**
 * Instantiates a new reusable {@link NumericTermStream} based on the field type.
 */
public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) {
  if (indexFieldData instanceof IndexNumericFieldData) {
    IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData;
    if (!numFieldData.getNumericType().isFloatingPoint()) {
      return new LongTermStream(reader, numFieldData);
    }
    else {
      throw new UnsupportedOperationException("Streaming floating points is unsupported");
    }
  }
  else {
    return new HashTermStream(reader, indexFieldData);
  }
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:18,
代码来源:NumericTermStream.java

示例17: FieldData

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public FieldData(IndexNumericFieldData indexFieldData) {
    this.indexFieldData = indexFieldData;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:4,
代码来源:ValuesSource.java

示例18: toFilter

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public Query toFilter(QueryShardContext context, int shardId, int numShards) {
    final MappedFieldType type = context.fieldMapper(field);
    if (type == null) {
        throw new IllegalArgumentException("field " + field + " not found");
    }

    boolean useTermQuery = false;
    if (UidFieldMapper.NAME.equals(field)) {
       useTermQuery = true;
    } else if (type.hasDocValues() == false) {
        throw new IllegalArgumentException("cannot load numeric doc values on " + field);
    } else {
        IndexFieldData ifm = context.getForField(type);
        if (ifm instanceof IndexNumericFieldData == false) {
            throw new IllegalArgumentException("cannot load numeric doc values on " + field);
        }
    }

    if (numShards == 1) {
        return useTermQuery ? new TermsSliceQuery(field, id, max) :
            new DocValuesSliceQuery(field, id, max);
    }
    if (max >= numShards) {
        // the number of slices is greater than the number of shards
        // in such case we can reduce the number of requested shards by slice

        // first we check if the slice is responsible of this shard
        int targetShard = id % numShards;
        if (targetShard != shardId) {
            // the shard is not part of this slice, we can skip it.
            return new MatchNoDocsQuery("this shard is not part of the slice");
        }
        // compute the number of slices where this shard appears
        int numSlicesInShard = max / numShards;
        int rest = max % numShards;
        if (rest > targetShard) {
            numSlicesInShard++;
        }

        if (numSlicesInShard == 1) {
            // this shard has only one slice so we must check all the documents
            return new MatchAllDocsQuery();
        }
        // get the new slice id for this shard
        int shardSlice = id / numShards;

        return useTermQuery ?
            new TermsSliceQuery(field, shardSlice, numSlicesInShard) :
            new DocValuesSliceQuery(field, shardSlice, numSlicesInShard);
    }
    // the number of shards is greater than the number of slices

    // check if the shard is assigned to the slice
    int targetSlice = shardId % max;
    if (id != targetSlice) {
        // the shard is not part of this slice, we can skip it.
        return new MatchNoDocsQuery("this shard is not part of the slice");
    }
    return new MatchAllDocsQuery();
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:61,
代码来源:SliceBuilder.java

示例19: parseDateVariable

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
private AbstractDistanceScoreFunction parseDateVariable(XContentParser parser, QueryShardContext context,
        MappedFieldType dateFieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    String scaleString = null;
    String originString = null;
    String offsetString = "0d";
    double decay = 0.5;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (DecayFunctionBuilder.SCALE.equals(parameterName)) {
            scaleString = parser.text();
        } else if (DecayFunctionBuilder.ORIGIN.equals(parameterName)) {
            originString = parser.text();
        } else if (DecayFunctionBuilder.DECAY.equals(parameterName)) {
            decay = parser.doubleValue();
        } else if (DecayFunctionBuilder.OFFSET.equals(parameterName)) {
            offsetString = parser.text();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    long origin;
    if (originString == null) {
        origin = context.nowInMillis();
    } else {
        origin = ((DateFieldMapper.DateFieldType) dateFieldType).parseToMilliseconds(originString, false, null, null, context);
    }

    if (scaleString == null) {
        throw new ElasticsearchParseException("[{}] must be set for date fields.", DecayFunctionBuilder.SCALE);
    }
    TimeValue val = TimeValue.parseTimeValue(scaleString, TimeValue.timeValueHours(24),
            DecayFunctionParser.class.getSimpleName() + ".scale");
    double scale = val.getMillis();
    val = TimeValue.parseTimeValue(offsetString, TimeValue.timeValueHours(24), DecayFunctionParser.class.getSimpleName() + ".offset");
    double offset = val.getMillis();
    IndexNumericFieldData numericFieldData = context.getForField(dateFieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:42,
代码来源:DecayFunctionBuilder.java

示例20: NumericFieldDataScoreFunction

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
NumericFieldDataScoreFunction(double origin, double scale, double decay, double offset, DecayFunction func,
                                     IndexNumericFieldData fieldData, MultiValueMode mode) {
    super(scale, decay, offset, func, mode);
    this.fieldData = fieldData;
    this.origin = origin;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:7,
代码来源:DecayFunctionBuilder.java

示例21: LongValuesComparatorSource

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public LongValuesComparatorSource(IndexNumericFieldData indexFieldData, @Nullable Object missingValue, MultiValueMode sortMode, Nested nested) {
    this.indexFieldData = indexFieldData;
    this.missingValue = missingValue;
    this.sortMode = sortMode;
    this.nested = nested;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:7,
代码来源:LongValuesComparatorSource.java

示例22: FloatValuesComparatorSource

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public FloatValuesComparatorSource(IndexNumericFieldData indexFieldData, @Nullable Object missingValue, MultiValueMode sortMode, Nested nested) {
    this.indexFieldData = indexFieldData;
    this.missingValue = missingValue;
    this.sortMode = sortMode;
    this.nested = nested;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:7,
代码来源:FloatValuesComparatorSource.java

示例23: DoubleValuesComparatorSource

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public DoubleValuesComparatorSource(IndexNumericFieldData indexFieldData, @Nullable Object missingValue, MultiValueMode sortMode, Nested nested) {
    this.indexFieldData = indexFieldData;
    this.missingValue = missingValue;
    this.sortMode = sortMode;
    this.nested = nested;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:7,
代码来源:DoubleValuesComparatorSource.java

示例24: ScaledFloatIndexFieldData

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
ScaledFloatIndexFieldData(IndexNumericFieldData scaledFieldData, double scalingFactor) {
    this.scaledFieldData = scaledFieldData;
    this.scalingFactor = scalingFactor;
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:ScaledFloatFieldMapper.java

示例25: createFieldComparator

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
protected IndexFieldData.XFieldComparatorSource createFieldComparator(String fieldName, MultiValueMode sortMode, Object missingValue, Nested nested) {
    IndexNumericFieldData fieldData = getForField(fieldName);
    return new LongValuesComparatorSource(fieldData, missingValue, sortMode, nested);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:6,
代码来源:LongNestedSortingTests.java

示例26: createFieldComparator

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
protected IndexFieldData.XFieldComparatorSource createFieldComparator(String fieldName, MultiValueMode sortMode, Object missingValue, Nested nested) {
    IndexNumericFieldData fieldData = getForField(fieldName);
    return new DoubleValuesComparatorSource(fieldData, missingValue, sortMode, nested);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:6,
代码来源:DoubleNestedSortingTests.java

示例27: createFieldComparator

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
protected IndexFieldData.XFieldComparatorSource createFieldComparator(String fieldName, MultiValueMode sortMode, Object missingValue, Nested nested) {
    IndexNumericFieldData fieldData = getForField(fieldName);
    return new FloatValuesComparatorSource(fieldData, missingValue, sortMode, nested);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:6,
代码来源:FloatNestedSortingTests.java

示例28: NumericFieldDataScoreFunction

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
public NumericFieldDataScoreFunction(double origin, double scale, double decay, double offset, DecayFunction func,
        IndexNumericFieldData fieldData, MultiValueMode mode) {
    super(scale, decay, offset, func, mode);
    this.fieldData = fieldData;
    this.origin = origin;
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:7,
代码来源:DecayFunctionParser.java

示例29: parse

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
@Override
public ScoreFunction parse(QueryParseContext parseContext, XContentParser parser) throws IOException, QueryParsingException {

    String currentFieldName = null;
    String field = null;
    float boostFactor = 1;
    FieldValueFactorFunction.Modifier modifier = FieldValueFactorFunction.Modifier.NONE;
    Double missing = null;
    XContentParser.Token token;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token.isValue()) {
            if ("field".equals(currentFieldName)) {
                field = parser.text();
            } else if ("factor".equals(currentFieldName)) {
                boostFactor = parser.floatValue();
            } else if ("modifier".equals(currentFieldName)) {
                modifier = FieldValueFactorFunction.Modifier.valueOf(parser.text().toUpperCase(Locale.ROOT));
            } else if ("missing".equals(currentFieldName)) {
                missing = parser.doubleValue();
            } else {
                throw new QueryParsingException(parseContext, NAMES[0] + " query does not support [" + currentFieldName + "]");
            }
        } else if("factor".equals(currentFieldName) && (token == XContentParser.Token.START_ARRAY || token == XContentParser.Token.START_OBJECT)) {
            throw new QueryParsingException(parseContext, "[" + NAMES[0] + "] field 'factor' does not support lists or objects");
        }
    }

    if (field == null) {
        throw new QueryParsingException(parseContext, "[" + NAMES[0] + "] required field 'field' missing");
    }

    SearchContext searchContext = SearchContext.current();
    MappedFieldType fieldType = searchContext.mapperService().smartNameFieldType(field);
    IndexNumericFieldData fieldData = null;
    if (fieldType == null) {
        if(missing == null) {
            throw new ElasticsearchException("Unable to find a field mapper for field [" + field + "]. No 'missing' value defined.");
        }
    } else {
        fieldData = searchContext.fieldData().getForField(fieldType);
    }
    return new FieldValueFactorFunction(field, boostFactor, modifier, missing, fieldData);
}
 

开发者ID:baidu,
项目名称:Elasticsearch,
代码行数:46,
代码来源:FieldValueFactorFunctionParser.java

示例30: LongTermStream

点赞 2

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
protected LongTermStream(IndexReader reader, IndexNumericFieldData fieldData) {
  super(reader);
  this.fieldData = fieldData;
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:5,
代码来源:NumericTermStream.java

示例31: newLongs

点赞 1

import org.elasticsearch.index.fielddata.IndexNumericFieldData; //导入依赖的package包/类
/**
 * Get a {@link FieldDataTermsQuery} that filters on non-floating point numeric terms found in a hppc
 * {@link LongHashSet}.
 *
 * @param encodedTerms  An encoded set of terms.
 * @param fieldData     The fielddata for the field.
 * @param cacheKey      A unique key to use for caching this query.
 * @return the query.
 */
public static FieldDataTermsQuery newLongs(final byte[] encodedTerms, final IndexNumericFieldData fieldData, final long cacheKey) {
  return new LongsFieldDataTermsQuery(encodedTerms, fieldData, cacheKey);
}
 

开发者ID:sirensolutions,
项目名称:siren-join,
代码行数:13,
代码来源:FieldDataTermsQuery.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)