Skip to content

Commit 05c1f32

Browse files
author
Ralf Schlatterbeck
committed
Small performance-improvement and bug-fix for indexer:
In rare cases find will return duplicate ids. The previous check that re-initialized the value would never match (id at that point was python's built-in function id). It's faster to not re-process an id when it has been seen.
1 parent ec68ba4 commit 05c1f32

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

roundup/backends/indexer_common.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: indexer_common.py,v 1.10 2008-08-18 07:03:44 richard Exp $
1+
#$Id: indexer_common.py,v 1.11 2008-09-11 19:41:07 schlatterbeck Exp $
22
import re, sets
33

44
from roundup import hyperdb
@@ -86,8 +86,9 @@ def search(self, search_terms, klass, ignore={}):
8686
propdefs = klass.getprops()
8787
for resid in klass.find(**propspec):
8888
resid = str(resid)
89-
if not nodeids.has_key(id):
90-
nodeids[resid] = {}
89+
if resid in nodeids:
90+
continue # we ignore duplicate resids
91+
nodeids[resid] = {}
9192
node_dict = nodeids[resid]
9293
# now figure out where it came from
9394
for linkprop in propspec.keys():

0 commit comments

Comments
 (0)