changeset 538:919b9410008e

let lucene.query.term take field and value as arguments
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 01 Jun 2015 00:51:44 -0600
parents 5fed3de0aac7
children 473e456444ff
files lucene/src/luan/modules/lucene/Lucene.luan
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 5fed3de0aac7 -r 919b9410008e lucene/src/luan/modules/lucene/Lucene.luan
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Mon Jun 01 00:42:00 2015 -0600
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Mon Jun 01 00:51:44 2015 -0600
@@ -74,11 +74,13 @@
 
 	queryTbl.all_docs = MatchAllDocsQuery.new()
 	
-	function queryTbl.term(t)
-		local iter = pairs(t)
-		local field, value = iter()
+	function queryTbl.term(field,value)
+		if value==nil and type(field)=="table" then
+			local iter = pairs(field)
+			field, value = iter()
+			iter()==nil or error "only one term allowed"
+		end
 		field and value or error "missing term"
-		iter()==nil or error "only one term allowed"
 		field = index.map_field_name(field)
 		local tp = type(value)
 		if tp == "string" then