mirror of https://github.com/apache/lucene.git
LUCENE-2549: Fix TimeLimitingCollector#TimeExceededException to record the absolute docid
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@965299 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
898430be9b
commit
828d00a3c7
|
@ -437,6 +437,9 @@ Bug fixes
|
|||
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
|
||||
|
|
|
@ -111,7 +111,7 @@ public class TimeLimitingCollector extends Collector {
|
|||
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;
|
||||
}
|
||||
|
@ -130,6 +130,8 @@ public class TimeLimitingCollector extends Collector {
|
|||
private final long timeout;
|
||||
private final Collector collector;
|
||||
|
||||
private int docBase;
|
||||
|
||||
/**
|
||||
* Create a TimeLimitedCollector wrapper over another {@link Collector} with a specified timeout.
|
||||
* @param collector the wrapped {@link Collector}
|
||||
|
@ -200,19 +202,20 @@ public class TimeLimitingCollector extends Collector {
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue