1 let querystring = require('querystring')
4 let globals = await env.site.get_json('/_config/globals.json')
5 let navbar = await _require('/navbar.jst')
6 let zet_site = await env.site.get_zettair('/_zet/site')
8 let query = env.parsed_url.query.query
9 let first = parseInt(env.parsed_url.query.first || '0')
10 let search = zet_site.search(query, first, 10)
12 `${env.parsed_url.host} search "${query}" first ${first} results ${search.results.length} total results ${search.total_results}`
26 if (search.results.length) {
27 p {`Showing results ${first + 1}–${first + search.results.length} of ${search.total_results}`}
30 for (let i = 0; i < search.results.length; ++i) {
31 let page = search.results[i].auxiliary
33 a(href=page) {`${globals.page_to_title[page] || page}`}
35 p {_out.push(search.results[i].summary)} // note: contains HTML
41 for (let i = 0; i * 10 < search.total_results; ++i) {
42 let page = '/search.html?' + querystring.stringify(
43 {query: query, first: i * 10}
45 let text = (i + 1).toString()
50 span.sr-only {'(current)'}
55 a(href=page) {`${text}`}