Mercurial Hosting > luan
comparison lucene/src/luan/modules/lucene/Web_search.luan @ 561:363d07e26549
remove SimplyHTML from lucene/Web_search
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 23 Jun 2015 16:45:16 -0600 |
parents | b2139b21b49c |
children | ca169567ce07 |
comparison
equal
deleted
inserted
replaced
560:2f39468680be | 561:363d07e26549 |
---|---|
1 local Luan = require "luan:Luan" | 1 local Luan = require "luan:Luan" |
2 local error = Luan.error | 2 local error = Luan.error |
3 local pairs = Luan.pairs or error() | 3 local pairs = Luan.pairs or error() |
4 local ipairs = Luan.ipairs or error() | 4 local ipairs = Luan.ipairs or error() |
5 local range = Luan.range or error() | 5 local range = Luan.range or error() |
6 local to_string = Luan.to_string or error() | 6 local to_string = Luan.to_string or error() |
9 local Http = require "luan:http/Http" | 9 local Http = require "luan:http/Http" |
10 local String = require "luan:String" | 10 local String = require "luan:String" |
11 local string_to_number = String.to_number or error() | 11 local string_to_number = String.to_number or error() |
12 local Html = require "luan:Html" | 12 local Html = require "luan:Html" |
13 | 13 |
14 | |
14 local M = {} | 15 local M = {} |
16 | |
17 local function style() %> | |
18 body { | |
19 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
20 margin: 2em 5%; | |
21 } | |
22 h2 { | |
23 margin-bottom: .5em; | |
24 } | |
25 label { | |
26 text-align: right; | |
27 min-width: 6em; | |
28 display: inline-block; | |
29 margin-right: .5em; | |
30 } | |
31 <% | |
32 end | |
15 | 33 |
16 local function form() %> | 34 local function form() %> |
17 <html> | 35 <html> |
18 <head> | 36 <head> |
19 <% Html.simply_html_head() %> | |
20 <title>Lucene Query</title> | 37 <title>Lucene Query</title> |
38 <style> | |
39 <% style() %> | |
40 input { | |
41 margin-top: 1em; | |
42 } | |
43 input[type="text"] { | |
44 font: inherit; | |
45 padding: .5em .8em; | |
46 border-radius: 8px; | |
47 border-style: groove; | |
48 } | |
49 input[type="text"]:focus { | |
50 border-color: #66afe9; | |
51 outline: none; | |
52 } | |
53 span[tip] { | |
54 color: #888; | |
55 font-size: smaller; | |
56 margin-left: .5em; | |
57 } | |
58 input[type="submit"] { | |
59 color: white; | |
60 background: #337ab7; | |
61 border-color: #337ab7; | |
62 font: inherit; | |
63 padding: .5em; | |
64 border-radius: 4px; | |
65 } | |
66 input[type="submit"]:hover { | |
67 background: #236aa7 !important; | |
68 } | |
69 </style> | |
21 </head> | 70 </head> |
22 <body> | 71 <body> |
23 <div container> | 72 <h2>Lucene Query</h2> |
24 <h3 margin-top="1.5em">Lucene Query</h3> | 73 <form horizontal name="form0" method="post"> |
25 <form horizontal name="form0" method="post" margin-top="2em"> | 74 <div> |
26 <div row> | 75 <label>Query:</label> |
27 <div colspan=2 align="right"> | 76 <input type=text name="query" size="80" autofocus /> |
28 <label>Query:</label> | 77 </div> |
29 </div> | 78 <div> |
30 <div colspan=10> | 79 <label></label> |
31 <input name="query" size="80" autofocus /> | 80 <span tip>Query examples: <i>type:user</i> or <i>+type:user +name:Joe"</i></span> |
32 <div textcolor="#888">Query examples: <i>type:user</i> or <i>+type:user +name:Joe"</i></div> | 81 </div> |
33 </div> | 82 <div> |
34 </div> | 83 <label>Max Rows:</label> |
35 <div row margin-top="1em"> | 84 <input type=text name="rows" value="100" size="3" maxlength="5" /> |
36 <div colspan=2 align="right"> | 85 </div> |
37 <label>Max Rows:</label> | 86 <div> |
38 </div> | 87 <label>Sort:</label> |
39 <div colspan=10> | 88 <input type=text name="sort" size="60" /> |
40 <input name="rows" value="100" size="3" maxlength="5" /></p> | 89 </div> |
41 </div> | 90 <div> |
42 </div> | 91 <label></label> |
43 <div row margin-top="1em"> | 92 <span tip>Sort examples: <i>name, id</i></span> |
44 <div colspan=2 align="right"> | 93 </div> |
45 <label>Sort:</label> | 94 <div> |
46 </div> | 95 <label></label> |
47 <div colspan=10> | 96 <input type="submit" /> |
48 <input name="sort" size="60" /> | 97 </div> |
49 <div textcolor="#888">Sort examples: <i>name, id</i></div> | 98 </form> |
50 </div> | |
51 </div> | |
52 <div row margin-top="1em"> | |
53 <div colspan=2></div> | |
54 <div colspan=10> | |
55 <input type="submit" textcolor="white" bgcolor="#337ab7" large/> | |
56 </div> | |
57 </div> | |
58 </form> | |
59 </div> | |
60 <% Html.simply_html_body_bottom() %> | |
61 </body> | 99 </body> |
62 </html> | 100 </html> |
63 <% end | 101 <% end |
64 | 102 |
65 | 103 |
66 local function result(query,sort,headers,table) %> | 104 local function result(query,sort,headers,table) %> |
67 <html> | 105 <html> |
68 <head> | 106 <head> |
69 <% Html.simply_html_head() %> | |
70 <title>Lucene Query</title> | 107 <title>Lucene Query</title> |
108 <style> | |
109 <% style() %> | |
110 table { | |
111 border-collapse: collapse; | |
112 width: 100%; | |
113 font-size: smaller; | |
114 } | |
115 th, td { | |
116 text-align: left; | |
117 padding: .5em; | |
118 border: solid 1px #ddd; | |
119 } | |
120 </style> | |
71 </head> | 121 </head> |
72 <body> | 122 <body> |
73 <div container> | 123 <h2>Lucene Query Results</h2> |
74 <h3 margin-top="1.5em">Lucene Query Results</h3> | 124 <p><label>Query:</label> <b><%=Html.encode(to_string(query))%></b></p> |
75 <div row> | 125 <p><label>Sort:</label> <b><%=Html.encode(to_string(sort))%></b></p> |
76 <div colspan=2 align="right"> | 126 <table> |
77 <label>Query:</label> | 127 <tr> |
78 </div> | 128 <th></th> |
79 <div colspan=10> | 129 <% for _, header in ipairs(headers) do %> |
80 <b><%=Html.encode(to_string(query))%></b></p> | 130 <th><%=header%></th> |
81 </div> | 131 <% end %> |
82 </div> | 132 </tr> |
83 <div row> | 133 <% for i, row in ipairs(table) do %> |
84 <div colspan=2 align="right"> | |
85 <label>Sort:</label> | |
86 </div> | |
87 <div colspan=10> | |
88 <b><%=Html.encode(to_string(sort))%></b></p> | |
89 </div> | |
90 </div> | |
91 <table border condensed margin-top="1.5em"> | |
92 <tr> | 134 <tr> |
93 <th></th> | 135 <td><%=i%></td> |
94 <% for _, header in ipairs(headers) do %> | 136 <% |
95 <th><%=header%></th> | 137 for col in range(1, #headers) do |
96 <% end %> | 138 local val = row[col] |
139 %><td><%= val and repr(val) or "" %></td><% | |
140 end | |
141 %> | |
97 </tr> | 142 </tr> |
98 <% for i, row in ipairs(table) do %> | 143 <% end %> |
99 <tr> | 144 </table> |
100 <td><%=i%></td> | |
101 <% | |
102 for col in range(1, #headers) do | |
103 local val = row[col] | |
104 %><td><%= val and repr(val) or "" %></td><% | |
105 end | |
106 %> | |
107 </tr> | |
108 <% end %> | |
109 </table> | |
110 </div> | |
111 <% Html.simply_html_body_bottom() %> | |
112 </body> | 145 </body> |
113 </html> | 146 </html> |
114 <% end | 147 <% end |
115 | 148 |
116 | 149 |