[Zope-Checkins] CVS: Products/ZCTextIndex - ZCTextIndex.py:1.48.2.2
Andreas Jung
andreas at andreas-jung.com
Tue May 17 14:11:11 EDT 2005
Update of /cvs-repository/Products/ZCTextIndex
In directory cvs.zope.org:/tmp/cvs-serv31115/lib/python/Products/ZCTextIndex
Modified Files:
Tag: Zope-2_7-branch
ZCTextIndex.py
Log Message:
- Collector #1784: fixed handling of multiple attributes in ZCTextIndex
=== Products/ZCTextIndex/ZCTextIndex.py 1.48.2.1 => 1.48.2.2 ===
--- Products/ZCTextIndex/ZCTextIndex.py:1.48.2.1 Fri Nov 26 06:53:50 2004
+++ Products/ZCTextIndex/ZCTextIndex.py Tue May 17 14:10:40 2005
@@ -159,22 +159,21 @@
except: fields = [ self._fieldname ]
res = 0
+ all_texts = []
for attr in fields:
- res += self._index_object(documentId, obj, threshold, attr)
+ text = getattr(obj, attr, None)
+ if text is None:
+ continue
+ if safe_callable(text):
+ text = text()
+ if text is None:
+ continue
+ all_texts.append(text)
- return res
-
- def _index_object(self, docid, obj, threshold=None, attr=None):
- # XXX We currently ignore subtransaction threshold
- text = getattr(obj, self._fieldname, None)
- if text is None:
- return 0
- if safe_callable(text):
- text = text()
- if text is None:
+ if all_texts:
+ return self.index.index_doc(documentId, ' '.join(all_texts))
+ else:
return 0
- count = self.index.index_doc(docid, text)
- return count
def unindex_object(self, docid):
if self.index.has_doc(docid):
More information about the Zope-Checkins
mailing list