1460
|
1 package goodjava.lucene.api;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import org.apache.lucene.index.AtomicReaderContext;
|
|
5 import org.apache.lucene.search.Collector;
|
|
6 import org.apache.lucene.search.Scorer;
|
|
7
|
|
8
|
|
9 public abstract class GoodCollector extends Collector {
|
|
10 private int docBase;
|
|
11
|
|
12 public boolean acceptsDocsOutOfOrder() {
|
|
13 return true;
|
|
14 }
|
|
15
|
|
16 public void setScorer(Scorer scorer) {}
|
|
17
|
|
18 public void setNextReader(AtomicReaderContext context) {
|
|
19 this.docBase = context.docBase;
|
|
20 }
|
|
21
|
|
22 public void collect(int doc) throws IOException {
|
|
23 collectDoc(docBase+doc);
|
|
24 }
|
|
25
|
|
26 public abstract void collectDoc(int doc) throws IOException;
|
|
27 }
|