X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=parsers%2F40_indexer.sh;h=56a8990bd89e2bbd3a9d2e6f8a5f65aa6de23c87;hb=391ca15c76ee74991dc8462ae76782497751a133;hp=c26584aeb101a34f008b83434446c4a9692273f1;hpb=b9d413c8014dd86a056b3f8fe80f8d1e39abb9c7;p=shellwiki diff --git a/parsers/40_indexer.sh b/parsers/40_indexer.sh index c26584a..56a8990 100755 --- a/parsers/40_indexer.sh +++ b/parsers/40_indexer.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2023 Paul Hänsch +# Copyright 2023 - 2024 Paul Hänsch # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -14,10 +14,10 @@ # 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%/}/" P="$_DATA/pages${DOC}" I="$_DATA/index/" +P="$PWD" I="$_DATA/index/" _DATE=$((_DATE + 1)) if [ "$SEARCH_INDEX" != true ] || [ ! -d "$P" ] || \ - [ -f "$P/#index.flag" -a ! "$P/#page.md" -nt "$P/#index.flag" ] + [ -f "$P/#index.flag" -a ! "$P/#index.flag" -ot "$P/#page.md" ] then cat exit 0 @@ -29,6 +29,7 @@ exec 3>&1 touch -d "@$_DATE" "$P/#index.flag" mkdir -p "$I" +DOC="$(STRING "${P#"$_DATA/pages"}")" { cat; printf \\n; } \ | while IFS='' read -r line; do @@ -52,7 +53,6 @@ done \ | while read -r num total freq word; do [ "$word" ] || continue printf "%i %s %f %i %i\n" \ - "$_DATE" "$(STRING "$DOC")" \ - "$freq" "$num" "$total" \ + "$_DATE" "$DOC" "$freq" "$num" "$total" \ >>"$I/$word" done