Mercurial Hosting > luan
diff src/goodjava/lucene/logging/OpDoer.java @ 1551:9cc4cee39b8b
add LuanOpDoer
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 04 Oct 2020 16:29:54 -0600 |
parents | 41c32da4cbd1 |
children | 52241b69c339 |
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/OpDoer.java Sat Oct 03 23:08:36 2020 -0600 +++ b/src/goodjava/lucene/logging/OpDoer.java Sun Oct 04 16:29:54 2020 -0600 @@ -3,52 +3,15 @@ import java.io.IOException; import java.util.Map; import org.apache.lucene.search.Query; -import org.apache.lucene.index.IndexReader; import goodjava.lucene.api.GoodIndexWriter; -public class OpDoer { - protected final GoodIndexWriter writer; - protected boolean isActive = true; - - protected OpDoer(GoodIndexWriter writer) { - this.writer = writer; - } - - public IndexReader openReader() throws IOException { - return writer.openReader(); - } - - public void commit() throws IOException { - if( !isActive ) - return; - writer.commit(); - } - - public void deleteAll(long time) throws IOException { - if( !isActive ) - return; - writer.deleteAll(); - } - - public void deleteDocuments(long time,Query query) throws IOException { - if( !isActive ) - return; - writer.deleteDocuments(query); - } - - public void addDocument(long time,Map<String,Object> storedFields) throws IOException { - if( !isActive ) - return; - writer.addDocument(storedFields); - } - - public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException { - if( !isActive ) - return; - writer.updateDocument(keyFieldName,storedFields); - } - - public void tag(long time,String tag) throws IOException {} - +public interface OpDoer { + public GoodIndexWriter writer(); + public void commit() throws IOException; + public void deleteAll(long time) throws IOException; + public void deleteDocuments(long time,Query query) throws IOException; + public void addDocument(long time,Map<String,Object> storedFields) throws IOException; + public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException; + public void tag(long time,String tag) throws IOException; }