Commit 2d5e7876 authored by Martijn Pieters's avatar Martijn Pieters

Reverse searching order; start with the presumably smaller specific set and...

Reverse searching order; start with the presumably smaller specific set and work our way up to larger and larger docid sets. This makes intersecting faster for most common index distributions.
parent 825bcee4
...@@ -178,7 +178,7 @@ class PathIndex(Persistent, SimpleItem): ...@@ -178,7 +178,7 @@ class PathIndex(Persistent, SimpleItem):
return IISet(self._unindex.keys()) return IISet(self._unindex.keys())
results = None results = None
for i, comp in enumerate(comps): for i, comp in reversed(list(enumerate(comps))):
if not self._index.get(comp, {}).has_key(level+i): return IISet() if not self._index.get(comp, {}).has_key(level+i): return IISet()
results = intersection(results, self._index[comp][level+i]) results = intersection(results, self._index[comp][level+i])
return results return results
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment