]> git.plutz.net Git - shellwiki/commitdiff
much faster indexer (but will require maintenance via cron)
authorPaul Hänsch <paul@plutz.net>
Fri, 22 Sep 2023 19:27:48 +0000 (21:27 +0200)
committerPaul Hänsch <paul@plutz.net>
Fri, 22 Sep 2023 19:27:48 +0000 (21:27 +0200)
parsers/40_indexer.sh

index 08060f1637ba6aa4b83a1d686fab601f09751ffd..7190b0b84f02c6a62f3a91b83f8887b767edac2f 100755 (executable)
@@ -49,20 +49,8 @@ done \
 ' \
 | while read -r num total freq word; do
   [ "$word" ] || continue
-  F="$I/$word"
-  L="$(STRING "$DOC")"
-
-  if LOCK "$F"; then
-    touch "$F"
-    { while read d l f n t; do
-      [ "$l" = "$L" ] \
-      || printf "%i    %s      %f      %i      %i\n" \
-                "$d" "$l" "$f" "$n" "$t"
-      done <"$F"
-      printf "%i       %s      %f      %i      %i\n" \
-             "$_DATE" "$L" "$freq" "$num" "$total"
-    } >"$F.$$"
-    mv -- "$F.$$" "$F"
-    RELEASE "$F"
-  fi
+  printf "%i   %s      %f      %i      %i\n" \
+         "$_DATE" "$(STRING "$DOC")" \
+         "$freq" "$num" "$total" \
+  >>"$I/$word"
 done