]> git.plutz.net Git - rigidfind/commitdiff
improved logging, less json rubbish
authorPaul Hänsch <paul@plutz.net>
Tue, 5 Mar 2024 23:48:19 +0000 (00:48 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 5 Mar 2024 23:48:19 +0000 (00:48 +0100)
index.cgi

index 07cb6e336848aad523af54610fa5c824e9866b71..532a323c5294957b8be47b7f647e3a6578ab4004 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -217,7 +217,7 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
   words="$(
     for j in $(DB2 "$J" iterate @); do
       json_get "$(UNSTRING "$j")" match_phrase_prefix.content
   words="$(
     for j in $(DB2 "$J" iterate @); do
       json_get "$(UNSTRING "$j")" match_phrase_prefix.content
-    done 2>/dev/null
+    done 2>/dev/null |tr \\n ' '
   )"
   debug "Search words: $words"
 
   )"
   debug "Search words: $words"
 
@@ -234,6 +234,8 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
   )"
   results="${results%  }"
 
   )"
   results="${results%  }"
 
+  times >&2
+
   cat <<-EOF
        Status: 200 OK\r
        X-elastic-product: Elasticsearch\r
   cat <<-EOF
        Status: 200 OK\r
        X-elastic-product: Elasticsearch\r
@@ -241,7 +243,6 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
        \r
        { "took":0,
          "timed_out":false,
        \r
        { "took":0,
          "timed_out":false,
-         "_shards":{"total":1,"successful":1,"skipped":0,"failed":0},
          "hits": {
            "total":{"value": $(DB2 "$results" count @) ,"relation":"eq"},
            "max_score": $(json_get "arr:$results" '[0]._score' 2>/dev/null || printf 0),
          "hits": {
            "total":{"value": $(DB2 "$results" count @) ,"relation":"eq"},
            "max_score": $(json_get "arr:$results" '[0]._score' 2>/dev/null || printf 0),