[Zope-CVS] CVS: Products/RecentItemsIndex - index.py:1.5 test.py:1.5
Casey Duncan
casey at zope.com
Tue Aug 10 12:01:27 EDT 2004
Update of /cvs-repository/Products/RecentItemsIndex
In directory cvs.zope.org:/tmp/cvs-serv15107
Modified Files:
index.py test.py
Log Message:
If no classifier field is configured for an index, always ignore the query value
=== Products/RecentItemsIndex/index.py 1.4 => 1.5 ===
--- Products/RecentItemsIndex/index.py:1.4 Mon Aug 9 12:23:18 2004
+++ Products/RecentItemsIndex/index.py Tue Aug 10 12:01:26 2004
@@ -126,6 +126,9 @@
if value is None and self.field_name is not None:
# Query all values
value = list(self._value2items.keys())
+ elif value is not None and self.field_name is None:
+ # Ignore value given if there is no classifier field
+ value = None
if isinstance(value, (types.TupleType, types.ListType)):
# Query for multiple values
results = []
=== Products/RecentItemsIndex/test.py 1.4 => 1.5 ===
--- Products/RecentItemsIndex/test.py:1.4 Mon Aug 9 12:23:18 2004
+++ Products/RecentItemsIndex/test.py Tue Aug 10 12:01:26 2004
@@ -328,6 +328,16 @@
expected = [docid for nil, docid in expected]
expected.reverse()
self.assertEqual([doc.docid for doc in result], expected[:10])
+
+ def test_query_no_classifier_ignores_value(self):
+ docs = self.test_index_many_no_classifier()
+ top = self._get_top_docs(docs)
+ result = self.index.query('ptooey')
+ expected = top['huey'] + top['dooey'] + top['looey']
+ expected.sort()
+ expected = [docid for nil, docid in expected]
+ expected.reverse()
+ self.assertEqual([doc.docid for doc in result], expected[:10])
def test_query_multiple_with_tuple(self):
expected = self.test_query_multiple_values()
More information about the Zope-CVS
mailing list