From: Paul Hänsch Date: Mon, 4 Mar 2024 21:57:01 +0000 (+0100) Subject: include _index field in search response X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=98fe1cdcebd49e0a6de909a50f5488d473f6e11c;p=rigidfind include _index field in search response --- diff --git a/index.cgi b/index.cgi index 61f811e..d4f4cec 100755 --- a/index.cgi +++ b/index.cgi @@ -6,6 +6,8 @@ [ "$_DATE" ] || _DATE="$(date +%s)" +debug "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL" + ingest() { local J="$1" @@ -192,7 +194,8 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then results="@ $( search "${_DATA}/${_INDEX}" $words \ | while read -r score id source; do - S="$(DB2 "" set _id str:"$(UNSTRING "${id#/}")")" + S="$(DB2 "" set _index str:"${_INDEX}")" + S="$(DB2 "$S" set _id str:"$(UNSTRING "${id#/}")")" S="$(DB2 "$S" set _score num:"$score")" S="$(DB2 "$S" set _source obj:"$(UNSTRING "$source")")" printf 'obj:%s\t' "$(STRING "$S")"