Mercurial Hosting > luan
comparison src/goodjava/lucene/logging/OpDoer.java @ 1551:9cc4cee39b8b
add LuanOpDoer
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 04 Oct 2020 16:29:54 -0600 |
parents | 41c32da4cbd1 |
children | 52241b69c339 |
comparison
equal
deleted
inserted
replaced
1550:0dc3be25ad20 | 1551:9cc4cee39b8b |
---|---|
1 package goodjava.lucene.logging; | 1 package goodjava.lucene.logging; |
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 import java.util.Map; | 4 import java.util.Map; |
5 import org.apache.lucene.search.Query; | 5 import org.apache.lucene.search.Query; |
6 import org.apache.lucene.index.IndexReader; | |
7 import goodjava.lucene.api.GoodIndexWriter; | 6 import goodjava.lucene.api.GoodIndexWriter; |
8 | 7 |
9 | 8 |
10 public class OpDoer { | 9 public interface OpDoer { |
11 protected final GoodIndexWriter writer; | 10 public GoodIndexWriter writer(); |
12 protected boolean isActive = true; | 11 public void commit() throws IOException; |
13 | 12 public void deleteAll(long time) throws IOException; |
14 protected OpDoer(GoodIndexWriter writer) { | 13 public void deleteDocuments(long time,Query query) throws IOException; |
15 this.writer = writer; | 14 public void addDocument(long time,Map<String,Object> storedFields) throws IOException; |
16 } | 15 public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException; |
17 | 16 public void tag(long time,String tag) throws IOException; |
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 } | 17 } |