[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: (was: LUCENE-3390-inverted.patch)

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Uwe Schindler
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4, 3.5
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-BitsInterface.patch, LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-inverted.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-inverted.patch

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Uwe Schindler
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4, 3.5
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-BitsInterface.patch, LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-inverted.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-inverted.patch

Patch with the BitSet inverted. We break backwards compatibility so this is not 
an issue at all.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Uwe Schindler
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4, 3.5
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-BitsInterface.patch, LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-inverted.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-BitsInterface.patch

I added a further test in TestFieldCache to check the Bits returned.

I think that's ready to commit.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-BitsInterface.patch, LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Doron Cohen (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Doron Cohen updated LUCENE-3390:


Attachment: LUCENE-3390-BitsInterface.patch

Attached patch with a test that fails before this fix (otherwise patch same as 
previous).

The test uses 4 collectors simultaneously, each with different missing values.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-BitsInterface.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-BitsInterface.patch

Here a patch with a more clean API (as noted by Mike McCandless):
- backported the Bits interface from Lucene trunk (do a svn cp 
http://svn.apache.org//trunk//Bits.java before applying the patch
- Added interface to the well-known impls in util package
- FieldCache.getUnValuesDocs returns Bits now which makes the API very clean

This breaks backwards a bit more, as Bits does not extend DocIdSet, so code 
using the new FieldCache method will break, before recompilation was enough (as 
FixedBitSet extends DocIdSet).

Mike: How about this?

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-BitsInterface.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-21 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-fix-like-trunk.patch

Final patch:
- Added changes for backwards breaks
- Removed the bogus docFreq check
- Optimized the case of empty unvalued docs bit set (like in trunk)

This patch is now 100% in line with trunk. The code was already tested in trunk 
and does not affect sort speed for the common case without missing value, as 
the compiler will ignore the additional null check.

Will commit later this day.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-18 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-fix-like-trunk.patch

Small change:
- added a TODO: In my opinion the mentioned check is bogus and can never work. 
IR.docFreq(new Term(field)) will never return the sum of all docFreqs from a 
field.
- Moved the empty bitmask check down and use cardinality().

I am currently looking into a possibility to remove the additional uninversion, 
if the FieldCache already uninverted the field. The bitset should be populated 
together with the values, but still stored as a separate cache entry.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-18 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-fix-like-trunk.patch

Here my final fix. The code in the comparator is exactly like trunk, the 
NumericComparator superclass was added and the API is now similar to trunk. 
Also fixed the remaining TODO.

With this code we break the already broken 3.4 code, but make it similar to 
trunk, so migration is easier again. It is unlikely that somebody is affected 
by this, in most cases a simple recompilation fixes the problem.

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-fix-like-trunk.patch, 
> LUCENE-3390-fix-like-trunk.patch, LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-18 Thread Uwe Schindler (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3390:
--

Attachment: LUCENE-3390-fix-like-trunk.patch

Here a quick fix:
- Uses same code like trunk inside the comparators
- Uses FixedBitSet instead of OpenBitSet

Unfortunately this breaks backwards compatibility as explained before.

This patch needs some cleanup (remove code duplication and maybe move the 
missingValue code to a numeric base class like in trunk). This is also broken 
in current code, it has missing value code in FieldComparator base class, which 
should only be in a NumericFieldComparator abstract base class (missing in 3.x).

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Assignee: Doron Cohen
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Fix For: 3.4
>
> Attachments: LUCENE-3390-fix-like-trunk.patch, LUCENE-3390.patch, 
> SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-09-01 Thread Doron Cohen (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Doron Cohen updated LUCENE-3390:


Attachment: LUCENE-3390.patch

Attached patch fixing this bug. 
TestSort was enhanced to test the new setMissingValue() method - actually 
merging the test from trunk r1002460 (LUCENE-2671).

All search test passed (running the rest now..)

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Attachments: LUCENE-3390.patch, SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Updated] (LUCENE-3390) Incorrect sort by Numeric values for documents missing the sorting field

2011-08-22 Thread Gilad Barkai (JIRA)

 [ 
https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gilad Barkai updated LUCENE-3390:
-

 Labels: double float int long numeric sort  (was: double numeric sort)
Description: 
While sorting results over a numeric field, documents which do not contain a 
value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
against Double, Float, Int & Long numeric fields ascending and descending 
order).
This behavior is unexpected, as zero is "comparable" to the rest of the values. 
A better solution would either be allowing the user to define such a 
"non-value" default, or always bring those document results as the last ones.

Example scenario:
Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
value.
Searching with MatchAllDocsQuery, with sort over that field in descending order 
yields the docid results of 0, 2, 1.

Asking for the top 2 documents brings the document without any value as the 2nd 
result - which seems as a bug?

  was:
While sorting results over a numeric double field, documents which do not 
contain a value for the sorting field seem to get 0 (ZERO) value in the sort. 
This behavior is unexpected, as zero is "comparable" to the rest of the values. 
A better solution would either be allowing the user to define such a 
"non-value" default, or always bring those document results as the last ones.

Example scenario:
Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
value.
Searching with MatchAllDocsQuery, with sort over that field in descending order 
yields the docid results of 0, 2, 1.

While the document with the missing value does match the query, I would expect 
it to come last, as it is not comparable by the other documents. For example, 
asking for the top 2 documents brings the document without any value which 
seems as a bug?

Summary: Incorrect sort by Numeric values for documents missing the 
sorting field  (was: Incorrect sort by Numeric (double) values for documents 
missing the sorting field)

> Incorrect sort by Numeric values for documents missing the sorting field
> 
>
> Key: LUCENE-3390
> URL: https://issues.apache.org/jira/browse/LUCENE-3390
> Project: Lucene - Java
>  Issue Type: Bug
>  Components: core/search
>Affects Versions: 3.3
>Reporter: Gilad Barkai
>Priority: Minor
>  Labels: double, float, int, long, numeric, sort
> Attachments: SortByDouble.java
>
>
> While sorting results over a numeric field, documents which do not contain a 
> value for the sorting field seem to get 0 (ZERO) value in the sort. (Tested 
> against Double, Float, Int & Long numeric fields ascending and descending 
> order).
> This behavior is unexpected, as zero is "comparable" to the rest of the 
> values. A better solution would either be allowing the user to define such a 
> "non-value" default, or always bring those document results as the last ones.
> Example scenario:
> Adding 3 documents, 1st with value 3.5d, 2nd with -10d, and 3rd without any 
> value.
> Searching with MatchAllDocsQuery, with sort over that field in descending 
> order yields the docid results of 0, 2, 1.
> Asking for the top 2 documents brings the document without any value as the 
> 2nd result - which seems as a bug?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org