comparison 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
comparison
equal deleted inserted replaced
1550:0dc3be25ad20 1551:9cc4cee39b8b
1 package goodjava.lucene.logging;
2
3 import java.io.IOException;
4 import java.util.Map;
5 import org.apache.lucene.search.Query;
6 import goodjava.lucene.api.GoodIndexWriter;
7
8
9 public class BasicOpDoer implements OpDoer {
10 protected final GoodIndexWriter writer;
11 protected boolean isActive = true;
12
13 public BasicOpDoer(GoodIndexWriter writer) {
14 this.writer = writer;
15 }
16
17 public GoodIndexWriter writer() {
18 return writer;
19 }
20
21 public void commit() throws IOException {
22 if( !isActive )
23 return;
24 writer.commit();
25 }
26
27 public void deleteAll(long time) throws IOException {
28 if( !isActive )
29 return;
30 writer.deleteAll();
31 }
32
33 public void deleteDocuments(long time,Query query) throws IOException {
34 if( !isActive )
35 return;
36 writer.deleteDocuments(query);
37 }
38
39 public void addDocument(long time,Map<String,Object> storedFields) throws IOException {
40 if( !isActive )
41 return;
42 writer.addDocument(storedFields);
43 }
44
45 public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException {
46 if( !isActive )
47 return;
48 writer.updateDocument(keyFieldName,storedFields);
49 }
50
51 public void tag(long time,String tag) throws IOException {}
52
53 }