當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。