Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneSnapshot.java @ 230:4438cb2e04d0
start lucene
git-svn-id: https://luan-java.googlecode.com/svn/trunk@231 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 30 Sep 2014 20:03:56 +0000 |
parents | |
children | ef39bc4d3f70 |
comparison
equal
deleted
inserted
replaced
229:2a54cb7d1cf4 | 230:4438cb2e04d0 |
---|---|
1 package luan.modules.lucene; | |
2 | |
3 import java.io.IOException; | |
4 import java.util.Collection; | |
5 import org.apache.lucene.index.IndexCommit; | |
6 | |
7 | |
8 public final class LuceneSnapshot { | |
9 private final LuceneIndex index; | |
10 private final IndexCommit ic; | |
11 | |
12 LuceneSnapshot(LuceneIndex index) { | |
13 this.index = index; | |
14 try { | |
15 this.ic = index.snapshotDeletionPolicy.snapshot(); | |
16 } catch(IOException e) { | |
17 throw new RuntimeException(e); | |
18 } | |
19 } | |
20 | |
21 // call in finally block | |
22 public void close() { | |
23 try { | |
24 index.snapshotDeletionPolicy.release(ic); | |
25 } catch(IOException e) { | |
26 throw new RuntimeException(e); | |
27 } | |
28 } | |
29 | |
30 public Collection<String> getFileNames() { | |
31 try { | |
32 return ic.getFileNames(); | |
33 } catch(IOException e) { | |
34 throw new RuntimeException(e); | |
35 } | |
36 } | |
37 | |
38 } |