You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/11/19 13:47:36 UTC
svn commit: r1203971 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
lucene/src/java/org/apache/lucene/util/NumericUtils.java
Author: uschindler
Date: Sat Nov 19 12:47:36 2011
New Revision: 1203971
URL: http://svn.apache.org/viewvc?rev=1203971&view=rev
Log:
Merged revision(s) 1203970 from lucene/dev/trunk:
LUCENE-3582: Add javadocs
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/NumericUtils.java
Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java?rev=1203971&r1=1203970&r2=1203971&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java Sat Nov 19 12:47:36 2011
@@ -111,7 +111,9 @@ public final class NumericRangeFilter<T
* Factory that creates a <code>NumericRangeFilter</code>, that filters a <code>double</code>
* range using the given <a href="NumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>.
* 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
+ * 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 NumericRangeFilter<Double> newDoubleRange(final String field, final int precisionStep,
@@ -126,7 +128,9 @@ public final class NumericRangeFilter<T
* 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).
* 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
+ * 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 NumericRangeFilter<Double> newDoubleRange(final String field,
@@ -141,7 +145,9 @@ public final class NumericRangeFilter<T
* Factory that creates a <code>NumericRangeFilter</code>, that filters a <code>float</code>
* range using the given <a href="NumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>.
* 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
+ * 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 NumericRangeFilter<Float> newFloatRange(final String field, final int precisionStep,
@@ -156,7 +162,9 @@ public final class NumericRangeFilter<T
* 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).
* 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
+ * 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 NumericRangeFilter<Float> newFloatRange(final String field,
Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java?rev=1203971&r1=1203970&r2=1203971&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java Sat Nov 19 12:47:36 2011
@@ -252,7 +252,9 @@ public final class NumericRangeQuery<T e
* Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>double</code>
* range using the given <a href="#precisionStepDesc"><code>precisionStep</code></a>.
* 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
+ * 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, final int precisionStep,
@@ -265,7 +267,9 @@ public final class NumericRangeQuery<T e
* 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 </≤ or >/≥ queries)
- * by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
+ * 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,
@@ -278,7 +282,9 @@ public final class NumericRangeQuery<T e
* Factory that creates a <code>NumericRangeQuery</code>, that queries a <code>float</code>
* range using the given <a href="#precisionStepDesc"><code>precisionStep</code></a>.
* 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
+ * 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, final int precisionStep,
@@ -291,7 +297,9 @@ public final class NumericRangeQuery<T e
* 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 </≤ or >/≥ queries)
- * by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
+ * 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,
Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/NumericUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/NumericUtils.java?rev=1203971&r1=1203970&r2=1203971&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/NumericUtils.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/util/NumericUtils.java Sat Nov 19 12:47:36 2011
@@ -250,6 +250,8 @@ public final class NumericUtils {
* The value is converted by getting their IEEE 754 floating-point "double format"
* bit layout and then some bits are swapped, to be able to compare the result as long.
* By this the precision is not reduced, but the value can easily used as a long.
+ * The sort order (including {@link Double#NaN}) is defined by
+ * {@link Double#compareTo}; {@code NaN} is greater than positive infinity.
* @see #sortableLongToDouble
*/
public static long doubleToSortableLong(double val) {
@@ -288,6 +290,8 @@ public final class NumericUtils {
* The value is converted by getting their IEEE 754 floating-point "float format"
* bit layout and then some bits are swapped, to be able to compare the result as int.
* By this the precision is not reduced, but the value can easily used as an int.
+ * The sort order (including {@link Float#NaN}) is defined by
+ * {@link Float#compareTo}; {@code NaN} is greater than positive infinity.
* @see #sortableIntToFloat
*/
public static int floatToSortableInt(float val) {