diff lucene/src/luan/modules/lucene/LuceneSearcher.java @ 285:582e8db4cdb6

add lucene Web_search git-svn-id: https://luan-java.googlecode.com/svn/trunk@286 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 02 Dec 2014 06:17:45 +0000
parents 8afe9f2fdfec
children 4d53e9fc1bd9
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneSearcher.java	Tue Dec 02 03:55:33 2014 +0000
+++ b/lucene/src/luan/modules/lucene/LuceneSearcher.java	Tue Dec 02 06:17:45 2014 +0000
@@ -19,6 +19,7 @@
 import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.TotalHitCountCollector;
 import org.apache.lucene.search.Scorer;
+import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.index.AtomicReaderContext;
 import luan.Luan;
 import luan.LuanState;
@@ -179,9 +180,14 @@
 	}
 
 	public Object[] search( final LuanState luan, LuanTable queryTbl, Object nObj, LuanTable sortTbl ) throws LuanException, IOException {
-		Query query = query(queryTbl);
-		if( query == null )
-			throw luan.exception("invalid query");
+		Query query;
+		if( queryTbl == null ) {
+			query = new MatchAllDocsQuery();
+		} else {
+			query = query(queryTbl);
+			if( query == null )
+				throw luan.exception("invalid query");
+		}
 		if( nObj instanceof LuanFunction ) {
 			final LuanFunction fn = (LuanFunction)nObj;
 			Collector col = new MyCollector() {