3 [ "${PATH_INFO%\[search\]}" = "$PATH_INFO" ] && return 1
5 . "$_EXEC/cgilite/storage.sh"
8 words="$( GET q | awk '
9 BEGIN { # Field separator FS should include punctuation, including Unicode Block U+2000 - U+206F
10 if ( length("ยก") == 1 ) # Utf-8 aware AWK
11 FS = "([] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '[\342\200\200-\342\201\257]')"')+";
13 FS = "([] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-]|%[0-9A-Fa-f]{2}|'"$(printf '\342\200[\200-\277]|\342\201[\201-\257]')"')+";
16 { for (n = 1; n <= NF; n++) printf "%s ", tolower($n); }
20 [ ! -f "$I/$w" ] && continue
22 while read date doc freq num total; do
23 P="$_DATA/pages$(UNSTRING "$doc")"
24 d="$(stat -c %Y -- "$P/#index.flag")"
25 [ "$d" -gt "$date" ] && continue
27 printf '%s %f\n' "$doc" "$freq"
31 { cnt[$1]++; weight[$1] = weight[$1] ? weight[$1] * $2 : $2; }
32 END { m = 0; for (d in cnt) m = ( m < cnt[d] ) ? cnt[d] : m;
33 for (d in cnt) if ( cnt[d] == m ) printf "%f %s\n", weight[d], d;
37 | while read freq doc; do
38 page="$(UNSTRING "$doc")"
39 acl_read "$page" || continue
40 printf '<li><a href="%s">%s</a></li>' "$(URL "$page")" "$(HTML "$page")"
45 <h1>$(_ "Search results")</h1>
46 <input class="search" name="q" placeholder="$(_ Search)" value="$(HTML $words)"><button class="search" type="submit">$(_ Search)</button>
48 <ol class="searchresults">