From: Paul Hänsch <paul@plutz.net>
Date: Tue, 5 Mar 2024 16:09:09 +0000 (+0100)
Subject: bugfix: do not kill stderr ;-)
X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=9bc47aeb3d7417638c896e4f79d5c9d4c4109719;p=rigidfind

bugfix: do not kill stderr ;-)
---

diff --git a/index.cgi b/index.cgi
index 50fb338..d936d40 100755
--- a/index.cgi
+++ b/index.cgi
@@ -234,7 +234,7 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
   )"
   results="${results%	}"
 
-  cat <<-EOF
+  debug <<-EOF
 	Status: 200 OK
 	X-elastic-product: Elasticsearch
 	Content-Type: application/vnd.elasticsearch+json;compatible-with=8
@@ -244,7 +244,7 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then
 	  "_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>&- || printf 0),
+	    "max_score": $(json_get "arr:$results" '[0]._score' 2>/dev/null || printf 0),
 	    "hits": $(json_dump "arr:$results")
 	  }
 	}