diff lucene/src/luan/modules/lucene/LuceneIndex.java @ 252:3896138955b1

web testing... git-svn-id: https://luan-java.googlecode.com/svn/trunk@253 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 20 Oct 2014 02:23:00 +0000
parents ef39bc4d3f70
children 4d53e9fc1bd9
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java	Sun Oct 19 03:38:47 2014 +0000
+++ b/lucene/src/luan/modules/lucene/LuceneIndex.java	Mon Oct 20 02:23:00 2014 +0000
@@ -93,6 +93,17 @@
 		return new LuceneSnapshot(this);
 	}
 
+	public void delete_all() throws IOException {
+		writeLock.lock();
+		try {
+			writer.deleteAll();
+			writer.commit();
+			id = idLim = 0;
+		} finally {
+			writeLock.unlock();
+		}
+	}
+
 
 	private long id = 0;
 	private long idLim = 0;
@@ -184,6 +195,7 @@
 			add( tbl, "backup", LuanState.class, String.class );
 			add( tbl, "Writer", LuanState.class, LuanFunction.class );
 			add( tbl, "Searcher", LuanState.class, LuanFunction.class );
+			add( tbl, "delete_all" );
 		} catch(NoSuchMethodException e) {
 			throw new RuntimeException(e);
 		}