Mercurial Hosting > luan
changeset 537:5fed3de0aac7
add Luan.assert_double and add assert_* to Web_search query env
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 01 Jun 2015 00:42:00 -0600 |
parents | 3058870cbe83 |
children | 919b9410008e |
files | core/src/luan/modules/BasicLuan.java core/src/luan/modules/Luan.luan lucene/src/luan/modules/lucene/Web_search.luan |
diffstat | 3 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/src/luan/modules/BasicLuan.java Mon Jun 01 00:27:45 2015 -0600 +++ b/core/src/luan/modules/BasicLuan.java Mon Jun 01 00:42:00 2015 -0600 @@ -139,6 +139,10 @@ return v; } + public static double assert_double(LuanState luan,double v) throws LuanException { + return v; + } + @LuanMethod public static byte[] assert_binary(LuanState luan,byte[] v) throws LuanException { Utils.checkNotNull(luan,v); return v;
--- a/core/src/luan/modules/Luan.luan Mon Jun 01 00:27:45 2015 -0600 +++ b/core/src/luan/modules/Luan.luan Mon Jun 01 00:42:00 2015 -0600 @@ -5,6 +5,7 @@ M.assert_binary = BasicLuan.assert_binary M.assert_boolean = BasicLuan.assert_boolean +M.assert_double = BasicLuan.assert_double M.assert_integer = BasicLuan.assert_integer M.assert_long = BasicLuan.assert_long M.assert_number = BasicLuan.assert_number
--- a/lucene/src/luan/modules/lucene/Web_search.luan Mon Jun 01 00:27:45 2015 -0600 +++ b/lucene/src/luan/modules/lucene/Web_search.luan Mon Jun 01 00:42:00 2015 -0600 @@ -1,4 +1,7 @@ local Luan = require "luan:Luan" +local assert_integer = Luan.assert_integer +local assert_long = Luan.assert_long +local assert_double = Luan.assert_double local load = Luan.load local pairs = Luan.pairs local ipairs = Luan.ipairs @@ -130,7 +133,13 @@ form() return end - local query = load(query_string,"<query>",{query=index.query},true)() + local query_env = { + query=index.query; + assert_integer=assert_integer; + assert_long=assert_long; + assert_double=assert_double; + } + local query = load(query_string,"<query>",query_env,true)() local rows = Http.request.parameter.rows.to_number() local sort = load(Http.request.parameter.sort,"<sort>",{sort=index.query.sort},true)() index.Searcher( function(searcher)