diff src/goodjava/lucene/api/GoodCollector.java @ 1460:3ab0d043370f

start lucene.api
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 23 Mar 2020 00:04:42 -0600
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/goodjava/lucene/api/GoodCollector.java	Mon Mar 23 00:04:42 2020 -0600
@@ -0,0 +1,27 @@
+package goodjava.lucene.api;
+
+import java.io.IOException;
+import org.apache.lucene.index.AtomicReaderContext;
+import org.apache.lucene.search.Collector;
+import org.apache.lucene.search.Scorer;
+
+
+public abstract class GoodCollector extends Collector {
+	private int docBase;
+
+	public boolean acceptsDocsOutOfOrder() {
+		return true;
+	}
+
+	public void setScorer(Scorer scorer) {}
+
+	public void setNextReader(AtomicReaderContext context) {
+		this.docBase = context.docBase;
+	}
+
+	public void collect(int doc) throws IOException {
+		collectDoc(docBase+doc);
+	}
+
+	public abstract void collectDoc(int doc) throws IOException;
+}