lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (LUCENE-1583) SpanOrQuery skipTo() doesn't always move forwards
Date Tue, 14 Jul 2009 21:05:14 GMT

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

Mark Miller resolved LUCENE-1583.
---------------------------------

       Resolution: Fixed
    Lucene Fields: [New, Patch Available]  (was: [New])

Thanks Moti!

> SpanOrQuery skipTo() doesn't always move forwards
> -------------------------------------------------
>
>                 Key: LUCENE-1583
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1583
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 1.9, 2.0.0, 2.1, 2.2, 2.3, 2.3.1, 2.3.2, 2.4, 2.4.1
>            Reporter: Moti Nisenson
>            Assignee: Mark Miller
>            Priority: Minor
>             Fix For: 2.9
>
>         Attachments: LUCENE-1583.patch, LUCENE-1583.patch
>
>
> In SpanOrQuery the skipTo() method is improperly implemented if the target doc is less
than or equal to the current doc, since skipTo() may not be called for any of the clauses'
spans:
>     public boolean skipTo(int target) throws IOException {
>           if (queue == null) {
>             return initSpanQueue(target);
>           }
>           while (queue.size() != 0 && top().doc() < target) {
>             if (top().skipTo(target)) {
>               queue.adjustTop();
>             } else {
>               queue.pop();
>             }
>           }
>           
>         	return queue.size() != 0;
>         }
> This violates the correct behavior (as described in the Spans interface documentation),
that skipTo() should always move forwards, in other words the correct implementation would
be:
>     public boolean skipTo(int target) throws IOException {
>           if (queue == null) {
>             return initSpanQueue(target);
>           }
>           boolean skipCalled = false;
>           while (queue.size() != 0 && top().doc() < target) {
>             if (top().skipTo(target)) {
>               queue.adjustTop();
>             } else {
>               queue.pop();
>             }
>             skipCalled = true;
>           }
>           
>           if (skipCalled) {
>         	return queue.size() != 0;
>           }
>           return next();
>         }

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


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


Mime
View raw message