Index: CHANGES.txt =================================================================== --- CHANGES.txt (revision 965112) +++ CHANGES.txt (working copy) @@ -437,6 +437,9 @@ and float were not affected. (Yonik Seeley, Uwe Schindler) +* LUCENE-2549: Fix TimeLimitingCollector#TimeExceededException to record + the absolute docid. (Uwe Schindler) + New features * LUCENE-2128: Parallelized fetching document frequencies during weight Index: src/java/org/apache/lucene/search/TimeLimitingCollector.java =================================================================== --- src/java/org/apache/lucene/search/TimeLimitingCollector.java (revision 965112) +++ src/java/org/apache/lucene/search/TimeLimitingCollector.java (working copy) @@ -111,7 +111,7 @@ public long getTimeElapsed() { return timeElapsed; } - /** Returns last doc that was collected when the search time exceeded. */ + /** Returns last doc (absolute doc id) that was collected when the search time exceeded. */ public int getLastDocCollected() { return lastDocCollected; } @@ -129,6 +129,8 @@ private final long t0; private final long timeout; private final Collector collector; + + private int docBase; /** * Create a TimeLimitedCollector wrapper over another {@link Collector} with a specified timeout. @@ -200,19 +202,20 @@ long time = TIMER_THREAD.getMilliseconds(); if (timeout < time) { if (greedy) { - //System.out.println(this+" greedy: before failing, collecting doc: "+doc+" "+(time-t0)); + //System.out.println(this+" greedy: before failing, collecting doc: "+(docBase + doc)+" "+(time-t0)); collector.collect(doc); } - //System.out.println(this+" failing on: "+doc+" "+(time-t0)); - throw new TimeExceededException( timeout-t0, time-t0, doc ); + //System.out.println(this+" failing on: "+(docBase + doc)+" "+(time-t0)); + throw new TimeExceededException( timeout-t0, time-t0, docBase + doc ); } - //System.out.println(this+" collecting: "+doc+" "+(time-t0)); + //System.out.println(this+" collecting: "+(docBase + doc)+" "+(time-t0)); collector.collect(doc); } @Override public void setNextReader(IndexReader reader, int base) throws IOException { collector.setNextReader(reader, base); + this.docBase = base; } @Override