comparison src/goodjava/lucene/logging/OpDoer.java @ 1549:41c32da4cbd1

lucene log work
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 03 Oct 2020 20:55:26 -0600
parents src/goodjava/lucene/logging/FilterGoodWriter.java@736ec76bbf42
children 9cc4cee39b8b
comparison
equal deleted inserted replaced
1548:736ec76bbf42 1549:41c32da4cbd1
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 org.apache.lucene.index.IndexReader;
7 import goodjava.lucene.api.GoodIndexWriter;
8
9
10 public class OpDoer {
11 protected final GoodIndexWriter writer;
12 protected boolean isActive = true;
13
14 protected OpDoer(GoodIndexWriter writer) {
15 this.writer = writer;
16 }
17
18 public IndexReader openReader() throws IOException {
19 return writer.openReader();
20 }
21
22 public void commit() throws IOException {
23 if( !isActive )
24 return;
25 writer.commit();
26 }
27
28 public void deleteAll(long time) throws IOException {
29 if( !isActive )
30 return;
31 writer.deleteAll();
32 }
33
34 public void deleteDocuments(long time,Query query) throws IOException {
35 if( !isActive )
36 return;
37 writer.deleteDocuments(query);
38 }
39
40 public void addDocument(long time,Map<String,Object> storedFields) throws IOException {
41 if( !isActive )
42 return;
43 writer.addDocument(storedFields);
44 }
45
46 public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException {
47 if( !isActive )
48 return;
49 writer.updateDocument(keyFieldName,storedFields);
50 }
51
52 public void tag(long time,String tag) throws IOException {}
53
54 }