Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/LuceneSnapshot.java @ 233:ef39bc4d3f70
basic lucene works
git-svn-id: https://luan-java.googlecode.com/svn/trunk@234 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 02 Oct 2014 02:58:55 +0000 |
parents | 4438cb2e04d0 |
children |
comparison
equal
deleted
inserted
replaced
232:9ce18106f95a | 233:ef39bc4d3f70 |
---|---|
7 | 7 |
8 public final class LuceneSnapshot { | 8 public final class LuceneSnapshot { |
9 private final LuceneIndex index; | 9 private final LuceneIndex index; |
10 private final IndexCommit ic; | 10 private final IndexCommit ic; |
11 | 11 |
12 LuceneSnapshot(LuceneIndex index) { | 12 LuceneSnapshot(LuceneIndex index) throws IOException { |
13 this.index = index; | 13 this.index = index; |
14 try { | 14 this.ic = index.snapshotDeletionPolicy.snapshot(); |
15 this.ic = index.snapshotDeletionPolicy.snapshot(); | |
16 } catch(IOException e) { | |
17 throw new RuntimeException(e); | |
18 } | |
19 } | 15 } |
20 | 16 |
21 // call in finally block | 17 // call in finally block |
22 public void close() { | 18 public void close() throws IOException { |
23 try { | 19 index.snapshotDeletionPolicy.release(ic); |
24 index.snapshotDeletionPolicy.release(ic); | |
25 } catch(IOException e) { | |
26 throw new RuntimeException(e); | |
27 } | |
28 } | 20 } |
29 | 21 |
30 public Collection<String> getFileNames() { | 22 public Collection<String> getFileNames() throws IOException { |
31 try { | 23 return ic.getFileNames(); |
32 return ic.getFileNames(); | |
33 } catch(IOException e) { | |
34 throw new RuntimeException(e); | |
35 } | |
36 } | 24 } |
37 | 25 |
38 } | 26 } |