You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Uwe Schindler <uw...@thetaphi.de> on 2011/11/19 13:52:38 UTC
RE: svn commit: r1203970 - in /lucene/dev/trunk/lucene/src/java/org/apache/lucene: search/NumericRangeFilter.java search/NumericRangeQuery.java util/NumericUtils.java
Dawid: Don't kill me because of:
"use a query with {@code min == max == Double.NaN}"
This is just for explanation :-) If it hurts you we can replace the == by :=
Uwe
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: uschindler@apache.org [mailto:uschindler@apache.org]
> Sent: Saturday, November 19, 2011 1:46 PM
> To: commits@lucene.apache.org
> Subject: svn commit: r1203970 - in
> /lucene/dev/trunk/lucene/src/java/org/apache/lucene:
> search/NumericRangeFilter.java search/NumericRangeQuery.java
> util/NumericUtils.java
>
> Author: uschindler
> Date: Sat Nov 19 12:46:21 2011
> New Revision: 1203970
>
> URL: http://svn.apache.org/viewvc?rev=1203970&view=rev
> Log:
> LUCENE-3582: Add javadocs
>
> Modified:
>
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeFil
> ter.java
>
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeQ
> uery.java
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/NumericUtils.java
>
> Modified:
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeFil
> ter.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lu
> cene/search/NumericRangeFilter.java?rev=1203970&r1=1203969&r2=1203970
> &view=diff
> ================================================================
> ==============
> ---
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeFil
> ter.java (original)
> +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRan
> +++ geFilter.java Sat Nov 19 12:46:21 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</co
> de></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</co
> de></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/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeQ
> uery.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lu
> cene/search/NumericRangeQuery.java?rev=1203970&r1=1203969&r2=120397
> 0&view=diff
> ================================================================
> ==============
> ---
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRangeQ
> uery.java (original)
> +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/NumericRan
> +++ geQuery.java Sat Nov 19 12:46:21 2011
> @@ -254,7 +254,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, @@ -267,7 +269,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, @@ -280,7 +284,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, @@ -293,7 +299,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/trunk/lucene/src/java/org/apache/lucene/util/NumericUtils.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lu
> cene/util/NumericUtils.java?rev=1203970&r1=1203969&r2=1203970&view=dif
> f
> ================================================================
> ==============
> --- lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/NumericUtils.java
> (original)
> +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/NumericUtils
> +++ .java Sat Nov 19 12:46:21 2011
> @@ -239,6 +239,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) { @@ -261,6 +263,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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: svn commit: r1203970 - in /lucene/dev/trunk/lucene/src/java/org/apache/lucene:
search/NumericRangeFilter.java search/NumericRangeQuery.java util/NumericUtils.java
Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
> Dawid: Don't kill me because of:
> "use a query with {@code min == max == Double.NaN}"
>
> This is just for explanation :-) If it hurts you we can replace the == by
> :=
>
No plans to kill anyone. I'm laid back.
Dawid