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 (JIRA)" <ji...@apache.org> on 2011/09/18 19:44:09 UTC
[jira] [Issue Comment Edited] (LUCENE-3390) Incorrect sort by
Numeric values for documents missing the sorting field
[ https://issues.apache.org/jira/browse/LUCENE-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13107480#comment-13107480 ]
Uwe Schindler edited comment on LUCENE-3390 at 9/18/11 5:43 PM:
----------------------------------------------------------------
The problem is that it's not easy to fix, because the unvalued values BitSet is exposed as DocIdSet not Bits like in trunk. The only quick fix is to clone the cached values before modifying in setNextReader and leave code unchanged.
Correct fix is to return Bits from getUnvaluedValues and so can do random access in compare/compareBottom, FieldComparator code can be copied 1:1 from trunk, only small changes needed. This would break code already using the new APIs in 3.x, but this is too broken, so we *must* change/fix this.
was (Author: thetaphi):
The problem is that it's not easy to fix, because the unvalued values BitSet is exposed as DocIdSet not Bits like in trunk. The only quick fix is to clone the cached values before modifying in setNextReader and leave code unchanged.
Correct fix is to return Bits from getUnvaluedValues and so can do random access in compare/compareBottom, FieldComparator code can be copied 1:1 from trunk, only small changes needed.
> 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.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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org