1548
|
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;
|
1549
|
7 import goodjava.lucene.api.GoodIndexWriter;
|
1548
|
8
|
|
9
|
1549
|
10 public class OpDoer {
|
|
11 protected final GoodIndexWriter writer;
|
1548
|
12 protected boolean isActive = true;
|
|
13
|
1549
|
14 protected OpDoer(GoodIndexWriter writer) {
|
1548
|
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
|
1549
|
28 public void deleteAll(long time) throws IOException {
|
1548
|
29 if( !isActive )
|
|
30 return;
|
|
31 writer.deleteAll();
|
|
32 }
|
|
33
|
1549
|
34 public void deleteDocuments(long time,Query query) throws IOException {
|
1548
|
35 if( !isActive )
|
|
36 return;
|
|
37 writer.deleteDocuments(query);
|
|
38 }
|
|
39
|
1549
|
40 public void addDocument(long time,Map<String,Object> storedFields) throws IOException {
|
1548
|
41 if( !isActive )
|
|
42 return;
|
|
43 writer.addDocument(storedFields);
|
|
44 }
|
|
45
|
1549
|
46 public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException {
|
1548
|
47 if( !isActive )
|
|
48 return;
|
|
49 writer.updateDocument(keyFieldName,storedFields);
|
|
50 }
|
|
51
|
1549
|
52 public void tag(long time,String tag) throws IOException {}
|
1548
|
53
|
|
54 }
|