Compress the index more, by not storing the label name for keywords.

This commit is contained in:
Georg Brandl
2008-09-24 08:53:17 +00:00
parent c4b660c5e0
commit 77e3718db9
2 changed files with 7 additions and 7 deletions

View File

@@ -123,14 +123,14 @@ class IndexBuilder(object):
rv = {}
dt = self._desctypes
for kw, (ref, _, _, _) in self.env.modules.iteritems():
rv[kw] = (ref, 0, 'module-' + kw)
rv[kw] = (ref, 0)
for kw, (ref, ref_type) in self.env.descrefs.iteritems():
try:
i = dt[ref_type]
except KeyError:
i = len(dt)
dt[ref_type] = i
rv[kw] = (ref, i, kw)
rv[kw] = (ref, i)
return rv
def freeze(self):

View File

@@ -329,13 +329,14 @@ var Search = {
var regularResults = [];
$('#search-progress').empty();
// lookup the keyword
// lookup as keyword
if (keyword != null) {
for (var kw in keywords) {
if (kw.toLowerCase().indexOf(keyword, kw.lastIndexOf('.')) > -1) {
match = keywords[kw];
descr = desctypes[match[1]] + _(', in ') + titles[match[0]];
keywordResults.push([filenames[match[0]], kw, match[2], descr]);
anchor = '#' + (match[1] == 0 ? 'module-' + kw : kw);
keywordResults.push([filenames[match[0]], kw, anchor, descr]);
}
}
}
@@ -382,7 +383,7 @@ var Search = {
// if we have still a valid result we can add it
// to the result list
if (valid)
regularResults.push([filenames[file], titles[file], null, null]);
regularResults.push([filenames[file], titles[file], '', null]);
}
// delete unused variables in order to not waste
@@ -409,8 +410,7 @@ var Search = {
listItem.append($('<a/>').attr(
'href',
item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
highlightstring +
(item[2] ? '#' + item[2] : '')).html(item[1]));
highlightstring + item[2]).html(item[1]));
if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem);