]> git.plutz.net Git - rigidfind/commitdiff
include _index field in search response
authorPaul Hänsch <paul@plutz.net>
Mon, 4 Mar 2024 21:57:01 +0000 (22:57 +0100)
committerPaul Hänsch <paul@plutz.net>
Mon, 4 Mar 2024 21:57:01 +0000 (22:57 +0100)
index.cgi

index 61f811e2a5b2b24623e6a7c34f87a7806e0c1820..d4f4cec6f8ed573ce27032ccdf9b0467798d0fee 100755 (executable)
--- 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")"