X-Git-Url: https://git.plutz.net//?a=blobdiff_plain;f=index.cgi;h=532a323c5294957b8be47b7f647e3a6578ab4004;hb=e3b48cfc1a043644495b1f20811b2505ea308257;hp=68d0ef2c21d126b8d8e1d5c08a5d8a4368b53455;hpb=6ce0d169f8dd165c215fbcce58f15e6be2e805de;p=rigidfind diff --git a/index.cgi b/index.cgi index 68d0ef2..532a323 100755 --- a/index.cgi +++ b/index.cgi @@ -211,13 +211,13 @@ elif [ "$REQUEST_METHOD" = "DELETE" ]; then exit 0 elif [ "$REQUEST_METHOD" = "POST" ]; then - J="$(json_load "$(head -c "${CONTENT_LENGTH:-0}" |debug)")" + J="$(json_load "$(head -c "${CONTENT_LENGTH:-0}")")" J="$(json_get "$J" query.bool.must.bool.should)" 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" @@ -234,6 +234,8 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then )" results="${results% }" + times >&2 + cat <<-EOF Status: 200 OK X-elastic-product: Elasticsearch @@ -241,10 +243,9 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then { "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>&- || printf 0), + "max_score": $(json_get "arr:$results" '[0]._score' 2>/dev/null || printf 0), "hits": $(json_dump "arr:$results") } }