[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/KeywordIndex - KeywordIndex.py:1.13.2.1
Casey Duncan
casey@zope.com
Fri, 28 Feb 2003 10:47:07 -0500
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/KeywordIndex
In directory cvs.zope.org:/tmp/cvs-serv22350
Modified Files:
Tag: casey-keyindex-unique-fix
KeywordIndex.py
Log Message:
Issue #828: Keyword indexes now properly handle duplicate values
Note that this fix does affect the reverse index data. Reverse index data is now
uniqueified and unordered. Tests have been updated to account for this.
=== Zope/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py 1.13 => 1.13.2.1 ===
--- Zope/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py:1.13 Thu Jan 23 12:46:23 2003
+++ Zope/lib/python/Products/PluginIndexes/KeywordIndex/KeywordIndex.py Fri Feb 28 10:46:36 2003
@@ -90,7 +90,13 @@
if callable(newKeywords):
newKeywords = newKeywords()
if hasattr(newKeywords,'capitalize'): # is it string-like ?
- newKeywords = (newKeywords, )
+ newKeywords = [newKeywords]
+ else:
+ # Uniqueify keywords
+ unique = {}
+ for k in newKeywords:
+ unique[k] = None
+ newKeywords = unique.keys()
return newKeywords
def unindex_objectKeywords(self, documentId, keywords):