Mercurial Hosting > luan
diff lucene/src/luan/modules/lucene/Web_search.luan @ 391:2f5cc9c2cbf0
replace Html.simply_html_page with simply_html_head and simply_html_body_bottom
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 24 Apr 2015 14:05:52 -0600 |
parents | fb18724521d2 |
children | 5b36f663a1b8 |
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/Web_search.luan Fri Apr 24 12:31:13 2015 -0600 +++ b/lucene/src/luan/modules/lucene/Web_search.luan Fri Apr 24 14:05:52 2015 -0600 @@ -10,95 +10,102 @@ local Html = require "luan:Html" -local function form() - Html.simply_html_page{ - head = function() %> - <title>Lucene Query</title> -<% end; - body = function() %> - <div container> - <h3 margin-top="1.5em">Lucene Query</h3> - <form horizontal name="form0" method="post" margin-top="2em"> - <div row> - <div colspan=2 align="right"> - <label>Query:</label> - </div> - <div colspan=10> - <input name="query" size="80" value="Query.all_docs" autofocus /> - <div textcolor="#888">Query examples: <i>Query.term{ type = 'user' }</i> or <i>"type:user AND name:Joe"</i></div> - </div> - </div> - <div row margin-top="1em"> - <div colspan=2 align="right"> - <label>Max Rows:</label> - </div> - <div colspan=10> - <input name="rows" value="100" size="3" maxlength="5" /></p> - </div> - </div> - <div row margin-top="1em"> - <div colspan=2 align="right"> - <label>Sort:</label> - </div> - <div colspan=10> - <input name="sort" size="60" /> - <div textcolor="#888">Sort examples: Query.sort{{ field = 'id', type='int' }}</div> - </div> - </div> - <div row margin-top="1em"> - <div colspan=2></div> - <div colspan=10> - <input type="submit" textcolor="white" bgcolor="#337ab7" large/> - </div> - </div> - </form> - </div> -<% end; - } -end - - -local function result(query,sort,headers,table) - Html.simply_html_page{ - body = function() %> - <div container> - <h3 margin-top="1.5em">Lucene Query Results</h3> +local function form() %> +<html> + <head> + <% Html.simply_html_head() %> + <title>Lucene Query</title> + </head> + <body> + <div container> + <h3 margin-top="1.5em">Lucene Query</h3> + <form horizontal name="form0" method="post" margin-top="2em"> <div row> <div colspan=2 align="right"> <label>Query:</label> </div> <div colspan=10> - <b><%=query%></b></p> + <input name="query" size="80" value="Query.all_docs" autofocus /> + <div textcolor="#888">Query examples: <i>Query.term{ type = 'user' }</i> or <i>"type:user AND name:Joe"</i></div> </div> </div> - <div row> + <div row margin-top="1em"> + <div colspan=2 align="right"> + <label>Max Rows:</label> + </div> + <div colspan=10> + <input name="rows" value="100" size="3" maxlength="5" /></p> + </div> + </div> + <div row margin-top="1em"> <div colspan=2 align="right"> <label>Sort:</label> </div> <div colspan=10> - <b><%=sort%></b></p> + <input name="sort" size="60" /> + <div textcolor="#888">Sort examples: Query.sort{{ field = 'id', type='int' }}</div> + </div> + </div> + <div row margin-top="1em"> + <div colspan=2></div> + <div colspan=10> + <input type="submit" textcolor="white" bgcolor="#337ab7" large/> </div> </div> - <table border condensed margin-top="1.5em"> + </form> + </div> + <% Html.simply_html_body_bottom() %> + </body> +</html> +<% end + + +local function result(query,sort,headers,table) %> +<html> + <head> + <% Html.simply_html_head() %> + <title>Lucene Query</title> + </head> + <body> + <div container> + <h3 margin-top="1.5em">Lucene Query Results</h3> + <div row> + <div colspan=2 align="right"> + <label>Query:</label> + </div> + <div colspan=10> + <b><%=query%></b></p> + </div> + </div> + <div row> + <div colspan=2 align="right"> + <label>Sort:</label> + </div> + <div colspan=10> + <b><%=sort%></b></p> + </div> + </div> + <table border condensed margin-top="1.5em"> + <tr> + <th></th> + <% for _, header in ipairs(headers) do %> + <th><%=header%></th> + <% end %> + </tr> + <% for i, row in ipairs(table) do %> <tr> - <th></th> - <% for _, header in ipairs(headers) do %> - <th><%=header%></th> + <td><%=i%></td> + <% for col in range(1, #headers) do %> + <td><%= row[col] or "" %></td> <% end %> </tr> - <% for i, row in ipairs(table) do %> - <tr> - <td><%=i%></td> - <% for col in range(1, #headers) do %> - <td><%= row[col] or "" %></td> - <% end %> - </tr> - <% end %> - </table> - </div> -<% end; - } -end + <% end %> + </table> + </div> + <% Html.simply_html_body_bottom() %> + </body> +</html> +<% end local function index_of(tbl,val)