From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 11 Dec 2021 19:19:27 +0300
Subject: Make searchtools.js support old searchindex.js files

Sphinx 4.3 has changed format of searchindex.js files, but in Debian
there are lots of packages built with older Sphinx, and we want to
keep them working for some time.

Forwarded: not-needed
---
 sphinx/themes/basic/static/searchtools.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js
index 0a44e85..88ab75a 100644
--- a/sphinx/themes/basic/static/searchtools.js
+++ b/sphinx/themes/basic/static/searchtools.js
@@ -324,6 +324,9 @@ var Search = {
     var results = [];
 
     for (var prefix in objects) {
+      if (!(objects[prefix] instanceof Array)) {
+        objects[prefix] = Object.entries(objects[prefix]).map(([name, match]) => [...match, name]);
+      }
       for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) {
         var match = objects[prefix][iMatch];
         var name = match[4];
