[Checkins] SVN: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/ZCTextIndex.py Try to keep 'do not reindex if not necessary' optimization
Gauthier Bastien
cvs-admin at zope.org
Thu Nov 15 20:58:52 UTC 2012
Log message for revision 128298:
Try to keep 'do not reindex if not necessary' optimization
Changed:
U Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/ZCTextIndex.py
-=-
Modified: Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/ZCTextIndex.py
===================================================================
--- Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/ZCTextIndex.py 2012-11-15 15:18:39 UTC (rev 128297)
+++ Products.ZCTextIndex/trunk/src/Products/ZCTextIndex/ZCTextIndex.py 2012-11-15 20:58:51 UTC (rev 128298)
@@ -176,6 +176,7 @@
try: fields = self._indexed_attrs
except: fields = [ self._fieldname ]
+ res = 0
all_texts = []
for attr in fields:
text = getattr(obj, attr, None)
@@ -194,7 +195,9 @@
# Check that we're sending only strings
all_texts = filter(lambda text: isinstance(text, basestring), \
all_texts)
- return self.index.index_doc(documentId, all_texts)
+ if all_texts or self.index.length():
+ return self.index.index_doc(documentId, all_texts)
+ return res
def unindex_object(self, docid):
if self.index.has_doc(docid):
More information about the checkins
mailing list