diff options
| author | armin.ronacher <devnull@localhost> | 2008-09-24 08:39:33 +0000 |
|---|---|---|
| committer | armin.ronacher <devnull@localhost> | 2008-09-24 08:39:33 +0000 |
| commit | 9b809fc7fcaed2da3a2f153ac114d318cd3d9827 (patch) | |
| tree | dd769bbb2318cb4afe8a110c02073a06f8a3c36b | |
| parent | 8e7aa47639b0bf920c1faa5f449be4da010b3ab2 (diff) | |
| download | sphinx-9b809fc7fcaed2da3a2f153ac114d318cd3d9827.tar.gz | |
Some tiny search fixes.
| -rw-r--r-- | sphinx/builder.py | 2 | ||||
| -rw-r--r-- | sphinx/search.py | 9 | ||||
| -rw-r--r-- | sphinx/static/searchtools.js | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/sphinx/builder.py b/sphinx/builder.py index 07e64651..62b96a17 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 9237ddcf..71e991de 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 94920136..e5fee28e 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; |
