diff lucene/src/luan/modules/lucene/LuceneIndex.java @ 303:fdb4bd391c28

add lucene close(); add Web_server.start(); git-svn-id: https://luan-java.googlecode.com/svn/trunk@304 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 18 Dec 2014 07:51:29 +0000
parents 4d53e9fc1bd9
children d34be4588556
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java	Thu Dec 18 04:56:30 2014 +0000
+++ b/lucene/src/luan/modules/lucene/LuceneIndex.java	Thu Dec 18 07:51:29 2014 +0000
@@ -39,7 +39,7 @@
 	final IndexWriter writer;
 	private DirectoryReader reader;
 	private LuceneSearcher searcher;
-	final FieldTable fields = new FieldTable();
+	public final FieldTable fields = new FieldTable();
 
 	public LuceneIndex(LuanState luan,String indexDirStr) throws LuanException, IOException {
 		File indexDir = new File(indexDirStr);
@@ -183,24 +183,9 @@
 		}
 	}
 
-	private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
-		t.put( method, new LuanJavaFunction(LuceneIndex.class.getMethod(method,parameterTypes),this) );
-	}
-
-	public LuanTable table() {
-		LuanTable tbl = Luan.newTable();
-		try {
-			tbl.put("fields",fields);
-			add( tbl, "to_string" );
-			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" );
-			add( tbl, "map_field_name", String.class );
-		} catch(NoSuchMethodException e) {
-			throw new RuntimeException(e);
-		}
-		return tbl;
+	public void close() throws IOException {
+		writer.close();
+		reader.close();
 	}
 
 }