comparison lucene/src/luan/modules/lucene/Web_search.luan @ 497:55f9f74f1e55

Http.request is now pure luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 17 May 2015 19:25:47 -0600
parents 2b9bc97f0439
children 92c3d22745b8
comparison
equal deleted inserted replaced
496:c65df5b25932 497:55f9f74f1e55
119 end 119 end
120 120
121 121
122 function of(index) 122 function of(index)
123 123
124 return { service = function() 124 return { respond = function()
125 Io.stdout = Http.response.text_writer() 125 Io.stdout = Http.response.text_writer()
126 local query_string = Http.request.parameters.query 126 local query_string = Http.request.parameter.query
127 if query_string == nil then 127 if query_string == nil then
128 form() 128 form()
129 return 129 return
130 end 130 end
131 local query = load(query_string,"<query>",{Query=index.query},true)() 131 local query = load(query_string,"<query>",{Query=index.query},true)()
132 local rows = Http.request.parameters.rows.to_number() 132 local rows = Http.request.parameter.rows.to_number()
133 local sort = load(Http.request.parameters.sort,"<sort>",{Query=index.query},true)() 133 local sort = load(Http.request.parameter.sort,"<sort>",{Query=index.query},true)()
134 index.Searcher( function(searcher) 134 index.Searcher( function(searcher)
135 local results, length, total_hits = searcher.search(query,rows,sort) 135 local results, length, total_hits = searcher.search(query,rows,sort)
136 local headers = {} 136 local headers = {}
137 local table = {} 137 local table = {}
138 for doc in results do 138 for doc in results do