Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Fix an NPE when using searcher.max.hits, but NOT using time limit.

Andrzej Bialecki58fbc0709988
diff --git a/src/java/org/apache/nutch/searcher/LuceneQueryOptimizer.java b/src/java/org/apache/nutch/searcher/LuceneQueryOptimizer.java
index 57a837113..8ffc33d07 100644
--- a/src/java/org/apache/nutch/searcher/LuceneQueryOptimizer.java
+++ b/src/java/org/apache/nutch/searcher/LuceneQueryOptimizer.java
@@ -104,8 +104,10 @@ class LuceneQueryOptimizer {
super(numHits);
this.maxHits = maxHits;
this.maxTicks = maxTicks;
- this.timer = timer;
- this.startTicks = timer.timeCounter;
+ if (timer != null) {
+ this.timer = timer;
+ this.startTicks = timer.timeCounter;
+ }
}
public void collect(int doc, float score) {