annotate src/goodjava/lucene/api/GoodCollector.java @ 1740:c9c974817d0c

add ServerSentEvents.sweep
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2022 22:05:11 -0600
parents 3ab0d043370f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1460
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 package goodjava.lucene.api;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 import java.io.IOException;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 import org.apache.lucene.index.AtomicReaderContext;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 import org.apache.lucene.search.Collector;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 import org.apache.lucene.search.Scorer;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 public abstract class GoodCollector extends Collector {
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 private int docBase;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 public boolean acceptsDocsOutOfOrder() {
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 return true;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 }
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 public void setScorer(Scorer scorer) {}
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 public void setNextReader(AtomicReaderContext context) {
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 this.docBase = context.docBase;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 }
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 public void collect(int doc) throws IOException {
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 collectDoc(docBase+doc);
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 }
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 public abstract void collectDoc(int doc) throws IOException;
3ab0d043370f start lucene.api
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 }