Mercurial Hosting > luan
diff src/goodjava/lucene/logging/BasicOpDoer.java @ 1551:9cc4cee39b8b
add LuanOpDoer
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 04 Oct 2020 16:29:54 -0600 |
parents | src/goodjava/lucene/logging/OpDoer.java@41c32da4cbd1 |
children | 52241b69c339 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/goodjava/lucene/logging/BasicOpDoer.java Sun Oct 04 16:29:54 2020 -0600 @@ -0,0 +1,53 @@ +package goodjava.lucene.logging; + +import java.io.IOException; +import java.util.Map; +import org.apache.lucene.search.Query; +import goodjava.lucene.api.GoodIndexWriter; + + +public class BasicOpDoer implements OpDoer { + protected final GoodIndexWriter writer; + protected boolean isActive = true; + + public BasicOpDoer(GoodIndexWriter writer) { + this.writer = writer; + } + + public GoodIndexWriter writer() { + return writer; + } + + 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 {} + +}