diff lucene/src/luan/modules/lucene/Lucene.luan @ 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 9ce18106f95a
children c5c60eca33dd
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Wed Oct 01 06:55:14 2014 +0000
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Thu Oct 02 02:58:55 2014 +0000
@@ -1,10 +1,6 @@
 import "Java"
 import "luan.modules.lucene.LuceneIndex"
 
-standard_fields = {
-	type = "type index";
-	id = "id index";
-}
 
 function Index(indexDir)
 	local index = LuceneIndex.new(indexDir).table()
@@ -22,12 +18,12 @@
 	end
 
 	function index.get_document(query)
-		index.Searcher( function(searcher)
+		return index.Searcher( function(searcher)
 			local results, _, total_hits = searcher.search(query,1)
 			if total_hits == 0 then
 				return nil
 			elseif total_hits > 1 then
-				error "found " .. total_hits .. " documents"
+				error( "found " .. total_hits .. " documents" )
 			end
 			return results()
 		end )