You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Rob Owen (JIRA)" <ji...@apache.org> on 2008/01/09 22:32:34 UTC

[jira] Created: (JCR-1302) ArrayHits does not end properly when skipTo doesn't find document

ArrayHits does not end properly when skipTo doesn't find document
-----------------------------------------------------------------

                 Key: JCR-1302
                 URL: https://issues.apache.org/jira/browse/JCR-1302
             Project: Jackrabbit
          Issue Type: Bug
          Components: query
    Affects Versions: 1.4
            Reporter: Rob Owen
             Fix For: 1.4


If skipTo(target) does not find a document that that has a higher value than the target, it falls out of the loop and calls next() possibly returning a previously found document. The patch makes sure that -1 is returned in this case, otherwise confusing results might occur.

Index: src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(revision 608900)
+++ src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(working copy)
@@ -87,9 +87,9 @@
             int nextDocValue = hits[i];
             if (nextDocValue >= target) {
                 index = i;
-                break;
+                return next();
             }
         }
-        return next();
+        return -1;
     }
 }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1302) ArrayHits does not end properly when skipTo doesn't find document

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557624#action_12557624 ] 

Christoph Kiehl commented on JCR-1302:
--------------------------------------

Thanks a lot Owen for tracking this down and providing a patch!

> ArrayHits does not end properly when skipTo doesn't find document
> -----------------------------------------------------------------
>
>                 Key: JCR-1302
>                 URL: https://issues.apache.org/jira/browse/JCR-1302
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core, query
>            Reporter: Rob Owen
>            Assignee: Christoph Kiehl
>             Fix For: 1.4
>
>
> If skipTo(target) does not find a document that that has a higher value than the target, it falls out of the loop and calls next() possibly returning a previously found document. The patch makes sure that -1 is returned in this case, otherwise confusing results might occur.
> Index: src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
> ===================================================================
> --- src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(revision 608900)
> +++ src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(working copy)
> @@ -87,9 +87,9 @@
>              int nextDocValue = hits[i];
>              if (nextDocValue >= target) {
>                  index = i;
> -                break;
> +                return next();
>              }
>          }
> -        return next();
> +        return -1;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1302) ArrayHits does not end properly when skipTo doesn't find document

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved JCR-1302.
--------------------------------

    Resolution: Fixed

Suggested fix (and a test case) committed by Christoph in revisions 610717 and 610719.

Merged to the 1.4 branch in revision 610770.

> ArrayHits does not end properly when skipTo doesn't find document
> -----------------------------------------------------------------
>
>                 Key: JCR-1302
>                 URL: https://issues.apache.org/jira/browse/JCR-1302
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core, query
>            Reporter: Rob Owen
>            Assignee: Christoph Kiehl
>             Fix For: 1.4
>
>
> If skipTo(target) does not find a document that that has a higher value than the target, it falls out of the loop and calls next() possibly returning a previously found document. The patch makes sure that -1 is returned in this case, otherwise confusing results might occur.
> Index: src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
> ===================================================================
> --- src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(revision 608900)
> +++ src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(working copy)
> @@ -87,9 +87,9 @@
>              int nextDocValue = hits[i];
>              if (nextDocValue >= target) {
>                  index = i;
> -                break;
> +                return next();
>              }
>          }
> -        return next();
> +        return -1;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (JCR-1302) ArrayHits does not end properly when skipTo doesn't find document

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl reassigned JCR-1302:
------------------------------------

    Assignee: Christoph Kiehl

> ArrayHits does not end properly when skipTo doesn't find document
> -----------------------------------------------------------------
>
>                 Key: JCR-1302
>                 URL: https://issues.apache.org/jira/browse/JCR-1302
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.4
>            Reporter: Rob Owen
>            Assignee: Christoph Kiehl
>             Fix For: 1.4
>
>
> If skipTo(target) does not find a document that that has a higher value than the target, it falls out of the loop and calls next() possibly returning a previously found document. The patch makes sure that -1 is returned in this case, otherwise confusing results might occur.
> Index: src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
> ===================================================================
> --- src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(revision 608900)
> +++ src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(working copy)
> @@ -87,9 +87,9 @@
>              int nextDocValue = hits[i];
>              if (nextDocValue >= target) {
>                  index = i;
> -                break;
> +                return next();
>              }
>          }
> -        return next();
> +        return -1;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1302) ArrayHits does not end properly when skipTo doesn't find document

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1302:
-------------------------------

          Component/s: jackrabbit-core
    Affects Version/s:     (was: 1.4)

I guess we didn't have this before JCR-1041, so the fix doesn't need to be applied to the 1.3 branch. But it would be good to have this in 1.4.

> ArrayHits does not end properly when skipTo doesn't find document
> -----------------------------------------------------------------
>
>                 Key: JCR-1302
>                 URL: https://issues.apache.org/jira/browse/JCR-1302
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core, query
>            Reporter: Rob Owen
>            Assignee: Christoph Kiehl
>             Fix For: 1.4
>
>
> If skipTo(target) does not find a document that that has a higher value than the target, it falls out of the loop and calls next() possibly returning a previously found document. The patch makes sure that -1 is returned in this case, otherwise confusing results might occur.
> Index: src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
> ===================================================================
> --- src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(revision 608900)
> +++ src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java	(working copy)
> @@ -87,9 +87,9 @@
>              int nextDocValue = hits[i];
>              if (nextDocValue >= target) {
>                  index = i;
> -                break;
> +                return next();
>              }
>          }
> -        return next();
> +        return -1;
>      }
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.