. "$_EXEC/cgilite/storage.sh"
I="$_DATA/index"
-words="$(GET q |tr '] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-' ' ')"
+words="$( GET q | sed -E '
+ :X $bY; N; bX; :Y
+ s;([] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-]|%[1-9A-Fa-f]{2})+; ;g
+')"
for w in ${words}; do
[ ! -f "$I/$w" ] && continue
while read date doc freq num total; do
P="$_DATA/pages$(UNSTRING "$doc")"
- d="$(stat -c %Y -- "$P/#page.md")"
+ d="$(stat -c %Y -- "$P/#index.flag")"
[ "$d" -gt "$date" ] && continue
printf '%s %f\n' "$doc" "$freq"
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-DOC="${PATH_INFO%/}/" DOC="${DOC%/\[*\]/}" DOC="${DOC%/}/"
-P="$_DATA/pages${DOC}" I="$_DATA/index/"
+DOC="${PATH_INFO%/}/" P="$_DATA/pages${DOC}" I="$_DATA/index/"
-if [ -f "$P/#index.flag" -a ! "$P/#page.md" -nt "$P/#index.flag" ]; then
+if [ -f "$P/#index.flag" -a ! "$P/#page.md" -nt "$P/#index.flag" ] || [ ! -d "$P" ]; then
cat
exit 0
fi
printf '%s\n' "$line"
done \
| awk '
- BEGIN { FS = "[] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-]+" }
- { for (n = 1; n <= NF; n++) if ( $n != "" ) { words[tolower($n)]++; total++; } }
+ BEGIN { FS = "([] \t\n\r!\"#'\''()*+,./:;<=>?\\^_`{|}~[-]|%[0-9A-Fa-f]{2})+" }
+ { for (n = 1; n <= NF; n++) {
+ if ( $n != "" && length($n) <= 128 ) {
+ words[tolower($n)]++; total++;
+ } } }
END { for (w in words) printf "%i %i %f %s\n", words[w], total, words[w] / total, w; }
' \
| while read num total freq word; do