[Python-checkins] r66573 - in doctools/trunk/sphinx: builder.py search.py static/searchtools.js
armin.ronacher
python-checkins at python.org
Wed Sep 24 10:39:33 CEST 2008
Author: armin.ronacher
Date: Wed Sep 24 10:39:33 2008
New Revision: 66573
Log:
Some tiny search fixes.
Modified:
doctools/trunk/sphinx/builder.py
doctools/trunk/sphinx/search.py
doctools/trunk/sphinx/static/searchtools.js
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py (original)
+++ doctools/trunk/sphinx/builder.py Wed Sep 24 10:39:33 2008
@@ -704,7 +704,7 @@
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
Modified: doctools/trunk/sphinx/search.py
==============================================================================
--- doctools/trunk/sphinx/search.py (original)
+++ doctools/trunk/sphinx/search.py Wed Sep 24 10:39:33 2008
@@ -100,10 +100,13 @@
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."""
Modified: doctools/trunk/sphinx/static/searchtools.js
==============================================================================
--- doctools/trunk/sphinx/static/searchtools.js (original)
+++ doctools/trunk/sphinx/static/searchtools.js Wed Sep 24 10:39:33 2008
@@ -371,7 +371,7 @@
// 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 @@
});
// combine both
- results = results.concat(regularResults);
+ results = regularResults.concat(results);
// print the results
var resultCount = results.length;
More information about the Python-checkins
mailing list