comparison src/goodjava/lucene/logging/FilterGoodWriter.java @ 1548:736ec76bbf42

lucene log work
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 27 Sep 2020 22:07:18 -0600
parents
children
comparison
equal deleted inserted replaced
1547:f24a9ba7551e 1548:736ec76bbf42
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.GoodWriter;
8
9
10 public class FilterGoodWriter implements GoodWriter {
11 protected final GoodWriter writer;
12 protected boolean isActive = true;
13
14 protected FilterGoodWriter(GoodWriter 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() throws IOException {
29 if( !isActive )
30 return;
31 writer.deleteAll();
32 }
33
34 public void deleteDocuments(Query query) throws IOException {
35 if( !isActive )
36 return;
37 writer.deleteDocuments(query);
38 }
39
40 public void addDocument(Map<String,Object> storedFields) throws IOException {
41 if( !isActive )
42 return;
43 writer.addDocument(storedFields);
44 }
45
46 public void updateDocument(String keyFieldName,Map<String,Object> storedFields) throws IOException {
47 if( !isActive )
48 return;
49 writer.updateDocument(keyFieldName,storedFields);
50 }
51
52 public void tag(String tag) throws IOException {}
53
54 }