Mercurial Hosting > luan
comparison src/luan/modules/lucene/LuanOpDoer.java @ 1563:8fbcc4747091
remove LuanFunction.luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 09 Nov 2020 01:37:57 -0700 |
parents | 52241b69c339 |
children |
comparison
equal
deleted
inserted
replaced
1562:b89212fd04b5 | 1563:8fbcc4747091 |
---|---|
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 goodjava.lucene.api.GoodIndexWriter; | 6 import goodjava.lucene.api.GoodIndexWriter; |
7 import goodjava.lucene.logging.OpDoer; | 7 import goodjava.lucene.logging.OpDoer; |
8 import goodjava.lucene.logging.BasicOpDoer; | 8 import goodjava.lucene.logging.BasicOpDoer; |
9 import luan.Luan; | |
9 import luan.LuanFunction; | 10 import luan.LuanFunction; |
10 import luan.LuanException; | 11 import luan.LuanException; |
11 import luan.LuanRuntimeException; | 12 import luan.LuanRuntimeException; |
12 | 13 |
13 | 14 |
14 final class LuanOpDoer implements OpDoer { | 15 final class LuanOpDoer implements OpDoer { |
16 private final Luan luan; | |
15 private final OpDoer opDoer; | 17 private final OpDoer opDoer; |
16 private final LuanFunction fn; | 18 private final LuanFunction fn; |
17 | 19 |
18 LuanOpDoer(GoodIndexWriter writer,LuanFunction fn) { | 20 LuanOpDoer(GoodIndexWriter writer,Luan luan,LuanFunction fn) { |
19 this.opDoer = new BasicOpDoer(writer); | 21 this.opDoer = new BasicOpDoer(writer); |
22 this.luan = luan; | |
20 this.fn = fn; | 23 this.fn = fn; |
21 } | 24 } |
22 | 25 |
23 public void commit() throws IOException { | 26 @Override public void commit() throws IOException { |
24 try { | 27 try { |
25 fn.call(new CommitAction(opDoer)); | 28 fn.call(luan,new CommitAction(opDoer)); |
26 } catch(LuanException e) { | 29 } catch(LuanException e) { |
27 throw new LuanRuntimeException(e); | 30 throw new LuanRuntimeException(e); |
28 } | 31 } |
29 } | 32 } |
30 | 33 |
31 public void deleteAll(long time) throws IOException { | 34 @Override public void deleteAll(long time) throws IOException { |
32 try { | 35 try { |
33 fn.call(new DeleteAllAction(opDoer,time)); | 36 fn.call(luan,new DeleteAllAction(opDoer,time)); |
34 } catch(LuanException e) { | 37 } catch(LuanException e) { |
35 throw new LuanRuntimeException(e); | 38 throw new LuanRuntimeException(e); |
36 } | 39 } |
37 } | 40 } |
38 | 41 |
39 public void deleteDocuments(long time,Query query) throws IOException { | 42 @Override public void deleteDocuments(long time,Query query) throws IOException { |
40 try { | 43 try { |
41 fn.call(new DeleteDocumentsAction(opDoer,time,query)); | 44 fn.call(luan,new DeleteDocumentsAction(opDoer,time,query)); |
42 } catch(LuanException e) { | 45 } catch(LuanException e) { |
43 throw new LuanRuntimeException(e); | 46 throw new LuanRuntimeException(e); |
44 } | 47 } |
45 } | 48 } |
46 | 49 |
47 public void addDocument(long time,Map<String,Object> storedFields) throws IOException { | 50 @Override public void addDocument(long time,Map<String,Object> storedFields) throws IOException { |
48 try { | 51 try { |
49 fn.call(new AddDocumentAction(opDoer,time,storedFields)); | 52 fn.call(luan,new AddDocumentAction(opDoer,time,storedFields)); |
50 } catch(LuanException e) { | 53 } catch(LuanException e) { |
51 throw new LuanRuntimeException(e); | 54 throw new LuanRuntimeException(e); |
52 } | 55 } |
53 } | 56 } |
54 | 57 |
55 public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException { | 58 @Override public void updateDocument(long time,String keyFieldName,Map<String,Object> storedFields) throws IOException { |
56 try { | 59 try { |
57 fn.call(new UpdateDocumentAction(opDoer,time,keyFieldName,storedFields)); | 60 fn.call(luan,new UpdateDocumentAction(opDoer,time,keyFieldName,storedFields)); |
58 } catch(LuanException e) { | 61 } catch(LuanException e) { |
59 throw new LuanRuntimeException(e); | 62 throw new LuanRuntimeException(e); |
60 } | 63 } |
61 } | 64 } |
62 | 65 |
63 public void tag(long time,String tag) throws IOException { | 66 @Override public void tag(long time,String tag) throws IOException { |
64 try { | 67 try { |
65 fn.call(new TagAction(opDoer,time,tag)); | 68 fn.call(luan,new TagAction(opDoer,time,tag)); |
66 } catch(LuanException e) { | 69 } catch(LuanException e) { |
67 throw new LuanRuntimeException(e); | 70 throw new LuanRuntimeException(e); |
68 } | 71 } |
69 } | 72 } |
70 | 73 |