view 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
line wrap: on
line source

package luan.modules.lucene;

import java.io.IOException;
import java.util.Collection;
import org.apache.lucene.index.IndexCommit;


public final class LuceneSnapshot {
	private final LuceneIndex index;
	private final IndexCommit ic;

	LuceneSnapshot(LuceneIndex index) throws IOException {
		this.index = index;
		this.ic = index.snapshotDeletionPolicy.snapshot();
	}

	// call in finally block
	public void close() throws IOException {
		index.snapshotDeletionPolicy.release(ic);
	}

	public Collection<String> getFileNames() throws IOException {
		return ic.getFileNames();
	}

}