当前位置: 首页>>代码示例>>Java>>正文


Java NumericUtils.PRECISION_STEP_DEFAULT属性代码示例

本文整理汇总了Java中org.apache.lucene.util.NumericUtils.PRECISION_STEP_DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java NumericUtils.PRECISION_STEP_DEFAULT属性的具体用法?Java NumericUtils.PRECISION_STEP_DEFAULT怎么用?Java NumericUtils.PRECISION_STEP_DEFAULT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.lucene.util.NumericUtils的用法示例。


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

示例1: doXContentBody

@Override
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
    super.doXContentBody(builder, includeDefaults, params);
    if (includeDefaults || pathType != Defaults.PATH_TYPE) {
        builder.field("path", pathType.name().toLowerCase(Locale.ROOT));
    }
    if (includeDefaults || fieldType().isLatLonEnabled() != GeoPointFieldMapper.Defaults.ENABLE_LATLON) {
        builder.field("lat_lon", fieldType().isLatLonEnabled());
    }
    if (fieldType().isLatLonEnabled() && (includeDefaults || fieldType().latFieldType().numericPrecisionStep() != NumericUtils.PRECISION_STEP_DEFAULT)) {
        builder.field("precision_step", fieldType().latFieldType().numericPrecisionStep());
    }
    if (includeDefaults || fieldType().isGeoHashEnabled() != Defaults.ENABLE_GEOHASH) {
        builder.field("geohash", fieldType().isGeoHashEnabled());
    }
    if (includeDefaults || fieldType().isGeoHashPrefixEnabled() != Defaults.ENABLE_GEOHASH_PREFIX) {
        builder.field("geohash_prefix", fieldType().isGeoHashPrefixEnabled());
    }
    if (fieldType().isGeoHashEnabled() && (includeDefaults || fieldType().geoHashPrecision() != Defaults.GEO_HASH_PRECISION)) {
        builder.field("geohash_precision", fieldType().geoHashPrecision());
    }
    if (includeDefaults || ignoreMalformed.explicit()) {
        builder.field(Names.IGNORE_MALFORMED, ignoreMalformed.value());
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:BaseGeoPointFieldMapper.java

示例2: testLongStream

public void testLongStream() throws Exception {
  final NumericTokenStream stream=new NumericTokenStream().setLongValue(lvalue);
  final TermToBytesRefAttribute bytesAtt = stream.getAttribute(TermToBytesRefAttribute.class);
  assertNotNull(bytesAtt);
  final TypeAttribute typeAtt = stream.getAttribute(TypeAttribute.class);
  assertNotNull(typeAtt);
  final NumericTokenStream.NumericTermAttribute numericAtt = stream.getAttribute(NumericTokenStream.NumericTermAttribute.class);
  assertNotNull(numericAtt);
  final BytesRef bytes = bytesAtt.getBytesRef();
  stream.reset();
  assertEquals(64, numericAtt.getValueSize());
  for (int shift=0; shift<64; shift+=NumericUtils.PRECISION_STEP_DEFAULT) {
    assertTrue("New token is available", stream.incrementToken());
    assertEquals("Shift value wrong", shift, numericAtt.getShift());
    bytesAtt.fillBytesRef();
    assertEquals("Term is incorrectly encoded", lvalue & ~((1L << shift) - 1L), NumericUtils.prefixCodedToLong(bytes));
    assertEquals("Term raw value is incorrectly encoded", lvalue & ~((1L << shift) - 1L), numericAtt.getRawValue());
    assertEquals("Type incorrect", (shift == 0) ? NumericTokenStream.TOKEN_TYPE_FULL_PREC : NumericTokenStream.TOKEN_TYPE_LOWER_PREC, typeAtt.type());
  }
  assertFalse("More tokens available", stream.incrementToken());
  stream.end();
  stream.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:TestNumericTokenStream.java

示例3: testIntStream

public void testIntStream() throws Exception {
  final NumericTokenStream stream=new NumericTokenStream().setIntValue(ivalue);
  final TermToBytesRefAttribute bytesAtt = stream.getAttribute(TermToBytesRefAttribute.class);
  assertNotNull(bytesAtt);
  final TypeAttribute typeAtt = stream.getAttribute(TypeAttribute.class);
  assertNotNull(typeAtt);
  final NumericTokenStream.NumericTermAttribute numericAtt = stream.getAttribute(NumericTokenStream.NumericTermAttribute.class);
  assertNotNull(numericAtt);
  final BytesRef bytes = bytesAtt.getBytesRef();
  stream.reset();
  assertEquals(32, numericAtt.getValueSize());
  for (int shift=0; shift<32; shift+=NumericUtils.PRECISION_STEP_DEFAULT) {
    assertTrue("New token is available", stream.incrementToken());
    assertEquals("Shift value wrong", shift, numericAtt.getShift());
    bytesAtt.fillBytesRef();
    assertEquals("Term is incorrectly encoded", ivalue & ~((1 << shift) - 1), NumericUtils.prefixCodedToInt(bytes));
    assertEquals("Term raw value is incorrectly encoded", ((long) ivalue) & ~((1L << shift) - 1L), numericAtt.getRawValue());
    assertEquals("Type incorrect", (shift == 0) ? NumericTokenStream.TOKEN_TYPE_FULL_PREC : NumericTokenStream.TOKEN_TYPE_LOWER_PREC, typeAtt.type());
  }
  assertFalse("More tokens available", stream.incrementToken());
  stream.end();
  stream.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:TestNumericTokenStream.java

示例4: testLongStream

public void testLongStream() throws Exception {
  final NumericTokenStream stream=new NumericTokenStream().setLongValue(lvalue);
  // use getAttribute to test if attributes really exist, if not an IAE will be throwed
  final TermToBytesRefAttribute bytesAtt = stream.getAttribute(TermToBytesRefAttribute.class);
  final TypeAttribute typeAtt = stream.getAttribute(TypeAttribute.class);
  final NumericTokenStream.NumericTermAttribute numericAtt = stream.getAttribute(NumericTokenStream.NumericTermAttribute.class);
  final BytesRef bytes = bytesAtt.getBytesRef();
  stream.reset();
  assertEquals(64, numericAtt.getValueSize());
  for (int shift=0; shift<64; shift+=NumericUtils.PRECISION_STEP_DEFAULT) {
    assertTrue("New token is available", stream.incrementToken());
    assertEquals("Shift value wrong", shift, numericAtt.getShift());
    final int hash = bytesAtt.fillBytesRef();
    assertEquals("Hash incorrect", bytes.hashCode(), hash);
    assertEquals("Term is incorrectly encoded", lvalue & ~((1L << shift) - 1L), NumericUtils.prefixCodedToLong(bytes));
    assertEquals("Term raw value is incorrectly encoded", lvalue & ~((1L << shift) - 1L), numericAtt.getRawValue());
    assertEquals("Type incorrect", (shift == 0) ? NumericTokenStream.TOKEN_TYPE_FULL_PREC : NumericTokenStream.TOKEN_TYPE_LOWER_PREC, typeAtt.type());
  }
  assertFalse("More tokens available", stream.incrementToken());
  stream.end();
  stream.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:TestNumericTokenStream.java

示例5: testIntStream

public void testIntStream() throws Exception {
  final NumericTokenStream stream=new NumericTokenStream().setIntValue(ivalue);
  // use getAttribute to test if attributes really exist, if not an IAE will be throwed
  final TermToBytesRefAttribute bytesAtt = stream.getAttribute(TermToBytesRefAttribute.class);
  final TypeAttribute typeAtt = stream.getAttribute(TypeAttribute.class);
  final NumericTokenStream.NumericTermAttribute numericAtt = stream.getAttribute(NumericTokenStream.NumericTermAttribute.class);
  final BytesRef bytes = bytesAtt.getBytesRef();
  stream.reset();
  assertEquals(32, numericAtt.getValueSize());
  for (int shift=0; shift<32; shift+=NumericUtils.PRECISION_STEP_DEFAULT) {
    assertTrue("New token is available", stream.incrementToken());
    assertEquals("Shift value wrong", shift, numericAtt.getShift());
    final int hash = bytesAtt.fillBytesRef();
    assertEquals("Hash incorrect", bytes.hashCode(), hash);
    assertEquals("Term is incorrectly encoded", ivalue & ~((1 << shift) - 1), NumericUtils.prefixCodedToInt(bytes));
    assertEquals("Term raw value is incorrectly encoded", ((long) ivalue) & ~((1L << shift) - 1L), numericAtt.getRawValue());
    assertEquals("Type incorrect", (shift == 0) ? NumericTokenStream.TOKEN_TYPE_FULL_PREC : NumericTokenStream.TOKEN_TYPE_LOWER_PREC, typeAtt.type());
  }
  assertFalse("More tokens available", stream.incrementToken());
  stream.end();
  stream.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:TestNumericTokenStream.java

示例6: newLongRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>long</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Long> newLongRange(final String field,
  Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.LONG, min, max, minInclusive, maxInclusive);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:NumericRangeQuery.java

示例7: newDoubleRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>double</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>.
 * {@link Double#NaN} will never match a half-open range, to hit {@code NaN} use a query
 * with {@code min == max == Double.NaN}.  By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Double> newDoubleRange(final String field,
  Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.DOUBLE, min, max, minInclusive, maxInclusive);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:NumericRangeQuery.java

示例8: NumericTokenStream

/**
 * Creates a token stream for numeric values using the default <code>precisionStep</code>
 * {@link NumericUtils#PRECISION_STEP_DEFAULT} (16). The stream is not yet initialized,
 * before using set a value using the various set<em>???</em>Value() methods.
 */
public NumericTokenStream() {
  this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, NumericUtils.PRECISION_STEP_DEFAULT);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:NumericTokenStream.java

示例9: newLongRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>long</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Long> newLongRange(final String field,
  Long min, Long max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<Long>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.LONG, min, max, minInclusive, maxInclusive);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:12,代码来源:NumericRangeQuery.java

示例10: newIntRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>int</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Integer> newIntRange(final String field,
  Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<Integer>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT, min, max, minInclusive, maxInclusive);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:12,代码来源:NumericRangeQuery.java

示例11: newDoubleRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>double</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>.
 * {@link Double#NaN} will never match a half-open range, to hit {@code NaN} use a query
 * with {@code min == max == Double.NaN}.  By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Double> newDoubleRange(final String field,
  Double min, Double max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<Double>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.DOUBLE, min, max, minInclusive, maxInclusive);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:14,代码来源:NumericRangeQuery.java

示例12: newFloatRange

/**
 * Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>float</code>
 * range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
 * You can have half-open ranges (which are in fact &lt;/&le; or &gt;/&ge; queries)
 * by setting the min or max value to <code>null</code>.
 * {@link Float#NaN} will never match a half-open range, to hit {@code NaN} use a query
 * with {@code min == max == Float.NaN}.  By setting inclusive to false, it will
 * match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
 */
public static NumericRangeQuery<Float> newFloatRange(final String field,
  Float min, Float max, final boolean minInclusive, final boolean maxInclusive
) {
  return new NumericRangeQuery<Float>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.FLOAT, min, max, minInclusive, maxInclusive);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:14,代码来源:NumericRangeQuery.java

示例13: NumericTokenStream

/**
 * Creates a token stream for numeric values using the default <code>precisionStep</code>
 * {@link NumericUtils#PRECISION_STEP_DEFAULT} (4). The stream is not yet initialized,
 * before using set a value using the various set<em>???</em>Value() methods.
 */
public NumericTokenStream() {
  this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, NumericUtils.PRECISION_STEP_DEFAULT);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:NumericTokenStream.java


注:本文中的org.apache.lucene.util.NumericUtils.PRECISION_STEP_DEFAULT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。