mirror of https://github.com/apache/lucene.git
LUCENE-5609: increase default NumericField precStep
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1592485 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
906261541f
commit
530a741b9a
|
@ -141,6 +141,10 @@ Optimizations
|
|||
that packs the core attributes into one impl, for faster clearAttributes(),
|
||||
saveState(), and restoreState(). (Uwe Schindler, Robert Muir)
|
||||
|
||||
* LUCENE-5609: Changed the default NumericField precisionStep from 4
|
||||
to 8 (for int/float) and 16 (for long/double), for faster indexing
|
||||
time and smaller indices. (Robert Muir, Uwe Schindler, Mike McCandless)
|
||||
|
||||
Bug fixes
|
||||
|
||||
* LUCENE-5600: HttpClientBase did not properly consume a connection if a server
|
||||
|
|
|
@ -214,7 +214,7 @@ public final class NumericTokenStream extends TokenStream {
|
|||
|
||||
/**
|
||||
* 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,
|
||||
* {@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() {
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class DoubleField extends Field {
|
|||
|
||||
/** Creates a stored or un-stored DoubleField with the provided value
|
||||
* and default <code>precisionStep</code> {@link
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* @param name field name
|
||||
* @param value 64-bit double value
|
||||
* @param stored Store.YES if the content should also be stored
|
||||
|
|
|
@ -125,6 +125,7 @@ public final class FloatField extends Field {
|
|||
TYPE_NOT_STORED.setOmitNorms(true);
|
||||
TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
TYPE_NOT_STORED.setNumericType(FieldType.NumericType.FLOAT);
|
||||
TYPE_NOT_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);
|
||||
TYPE_NOT_STORED.freeze();
|
||||
}
|
||||
|
||||
|
@ -139,13 +140,14 @@ public final class FloatField extends Field {
|
|||
TYPE_STORED.setOmitNorms(true);
|
||||
TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
TYPE_STORED.setNumericType(FieldType.NumericType.FLOAT);
|
||||
TYPE_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);
|
||||
TYPE_STORED.setStored(true);
|
||||
TYPE_STORED.freeze();
|
||||
}
|
||||
|
||||
/** Creates a stored or un-stored FloatField with the provided value
|
||||
* and default <code>precisionStep</code> {@link
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* @param name field name
|
||||
* @param value 32-bit double value
|
||||
* @param stored Store.YES if the content should also be stored
|
||||
|
|
|
@ -125,6 +125,7 @@ public final class IntField extends Field {
|
|||
TYPE_NOT_STORED.setOmitNorms(true);
|
||||
TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
TYPE_NOT_STORED.setNumericType(FieldType.NumericType.INT);
|
||||
TYPE_NOT_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);
|
||||
TYPE_NOT_STORED.freeze();
|
||||
}
|
||||
|
||||
|
@ -139,13 +140,14 @@ public final class IntField extends Field {
|
|||
TYPE_STORED.setOmitNorms(true);
|
||||
TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
TYPE_STORED.setNumericType(FieldType.NumericType.INT);
|
||||
TYPE_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);
|
||||
TYPE_STORED.setStored(true);
|
||||
TYPE_STORED.freeze();
|
||||
}
|
||||
|
||||
/** Creates a stored or un-stored IntField with the provided value
|
||||
* and default <code>precisionStep</code> {@link
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* @param name field name
|
||||
* @param value 32-bit integer value
|
||||
* @param stored Store.YES if the content should also be stored
|
||||
|
|
|
@ -155,7 +155,7 @@ public final class LongField extends Field {
|
|||
|
||||
/** Creates a stored or un-stored LongField with the provided value
|
||||
* and default <code>precisionStep</code> {@link
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* @param name field name
|
||||
* @param value 64-bit long value
|
||||
* @param stored Store.YES if the content should also be stored
|
||||
|
|
|
@ -68,7 +68,7 @@ public final class NumericRangeFilter<T extends Number> extends MultiTermQueryWr
|
|||
|
||||
/**
|
||||
* Factory that creates a <code>NumericRangeFilter</code>, that queries a <code>long</code>
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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.
|
||||
|
@ -98,7 +98,7 @@ public final class NumericRangeFilter<T extends Number> extends MultiTermQueryWr
|
|||
|
||||
/**
|
||||
* Factory that creates a <code>NumericRangeFilter</code>, that queries a <code>int</code>
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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.
|
||||
|
@ -130,7 +130,7 @@ public final class NumericRangeFilter<T extends Number> extends MultiTermQueryWr
|
|||
|
||||
/**
|
||||
* Factory that creates a <code>NumericRangeFilter</code>, that queries a <code>double</code>
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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
|
||||
|
@ -164,7 +164,7 @@ public final class NumericRangeFilter<T extends Number> extends MultiTermQueryWr
|
|||
|
||||
/**
|
||||
* Factory that creates a <code>NumericRangeFilter</code>, that queries a <code>float</code>
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (4).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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
|
||||
|
|
|
@ -196,7 +196,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
|
||||
/**
|
||||
* 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).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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.
|
||||
|
@ -222,7 +222,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
|
||||
/**
|
||||
* 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).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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.
|
||||
|
@ -230,7 +230,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
public static NumericRangeQuery<Integer> newIntRange(final String field,
|
||||
Integer min, Integer max, final boolean minInclusive, final boolean maxInclusive
|
||||
) {
|
||||
return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT, min, max, minInclusive, maxInclusive);
|
||||
return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT_32, NumericType.INT, min, max, minInclusive, maxInclusive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,7 +250,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
|
||||
/**
|
||||
* 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).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT} (16).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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
|
||||
|
@ -280,7 +280,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
|
||||
/**
|
||||
* 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).
|
||||
* range using the default <code>precisionStep</code> {@link NumericUtils#PRECISION_STEP_DEFAULT_32} (8).
|
||||
* You can have half-open ranges (which are in fact </≤ or >/≥ 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
|
||||
|
@ -290,7 +290,7 @@ public final class NumericRangeQuery<T extends Number> extends MultiTermQuery {
|
|||
public static NumericRangeQuery<Float> newFloatRange(final String field,
|
||||
Float min, Float max, final boolean minInclusive, final boolean maxInclusive
|
||||
) {
|
||||
return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.FLOAT, min, max, minInclusive, maxInclusive);
|
||||
return new NumericRangeQuery<>(field, NumericUtils.PRECISION_STEP_DEFAULT_32, NumericType.FLOAT, min, max, minInclusive, maxInclusive);
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
|
|
|
@ -72,12 +72,17 @@ public final class NumericUtils {
|
|||
private NumericUtils() {} // no instance!
|
||||
|
||||
/**
|
||||
* The default precision step used by {@link IntField},
|
||||
* {@link FloatField}, {@link LongField}, {@link
|
||||
* DoubleField}, {@link NumericTokenStream}, {@link
|
||||
* The default precision step used by {@link LongField},
|
||||
* {@link DoubleField}, {@link NumericTokenStream}, {@link
|
||||
* NumericRangeQuery}, and {@link NumericRangeFilter}.
|
||||
*/
|
||||
public static final int PRECISION_STEP_DEFAULT = 4;
|
||||
public static final int PRECISION_STEP_DEFAULT = 16;
|
||||
|
||||
/**
|
||||
* The default precision step used by {@link IntField} and
|
||||
* {@link FloatField}.
|
||||
*/
|
||||
public static final int PRECISION_STEP_DEFAULT_32 = 8;
|
||||
|
||||
/**
|
||||
* Longs are stored at lower precision by shifting off lower bits. The shift count is
|
||||
|
|
|
@ -75,7 +75,7 @@ public class TestFieldReuse extends BaseTokenStreamTestCase {
|
|||
// passing null
|
||||
TokenStream ts = intField.tokenStream(null, null);
|
||||
assertTrue(ts instanceof NumericTokenStream);
|
||||
assertEquals(NumericUtils.PRECISION_STEP_DEFAULT, ((NumericTokenStream)ts).getPrecisionStep());
|
||||
assertEquals(NumericUtils.PRECISION_STEP_DEFAULT_32, ((NumericTokenStream)ts).getPrecisionStep());
|
||||
assertNumericContents(5, ts);
|
||||
|
||||
// now reuse previous stream
|
||||
|
|
Loading…
Reference in New Issue