diff --git a/sphinx/builder.py b/sphinx/builder.py index 07e646518..62b96a17f 100644 --- a/sphinx/builder.py +++ b/sphinx/builder.py @@ -704,7 +704,7 @@ class StandaloneHTMLBuilder(Builder): self.indexer.load(f, self.indexer_format) finally: f.close() - except (IOError, OSError, NotImplementedError): + except (IOError, OSError, NotImplementedError, ValueError): # we catch NotImplementedError here because if no simplejson # is installed the searchindex can't be loaded pass diff --git a/sphinx/search.py b/sphinx/search.py index 9237ddcfd..71e991dee 100644 --- a/sphinx/search.py +++ b/sphinx/search.py @@ -100,10 +100,13 @@ class IndexBuilder(object): if isinstance(format, basestring): format = self.formats[format] frozen = format.load(stream) - index2fn = frozen[0] - self._titles = dict(zip(frozen[0], frozen[1])) + # if an old index is present, we treat it as not existing. + if not isinstance(frozen, dict): + raise ValueError('old format') + index2fn = frozen['filenames'] + self._titles = dict(zip(frozen['filenames'], frozen['titles'])) self._mapping = dict((k, set(index2fn[i] for i in v)) - for (k, v) in frozen[2].iteritems()) + for (k, v) in frozen['terms'].iteritems()) def dump(self, stream, format): """Dump the frozen index to a stream.""" diff --git a/sphinx/static/searchtools.js b/sphinx/static/searchtools.js index 949201363..e5fee28e9 100644 --- a/sphinx/static/searchtools.js +++ b/sphinx/static/searchtools.js @@ -371,7 +371,7 @@ var Search = { // if we have still a valid result we can add it // to the result list if (valid) - results.push([filenames[file], titles[file], null]); + regularResults.push([filenames[file], titles[file], null]); } // delete unused variables in order to not waste @@ -386,7 +386,7 @@ var Search = { }); // combine both - results = results.concat(regularResults); + results = regularResults.concat(results); // print the results var resultCount = results.length;