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