[Grok-dev] hurry.query fails when querying a value index
Sebastian Ware
sebastian at urbantalk.se
Fri May 28 08:48:57 EDT 2010
hurry.query doesn't accept value indexes as part of queries. Have I defined my value index in the wrong way or is there something else wrong? ValueIndex from zc.catalog.catalogindex doesn't implement IFieldIndex, should one use something else?
This is the ValueIndex definition (there is none in Grok):
from zc.catalog.catalogindex import ValueIndex
class Value(index.IndexDefinition):
index_class = ValueIndex
This is the code that causes the error:
now = datetime.now(tz = pytz.utc)
theQuery = query.Eq(('workflow_catalog', 'workflow_state'), PUBLISHED)
theQuery = theQuery & query.Eq(('workflow_catalog', 'object_type'), 'yhguiden_web_editorial_promo')
theQuery = theQuery & query.Le(('start_date_end_date_catalog', 'start_datetime'), now)
theQuery = theQuery & query.Ge(('start_date_end_date_catalog', 'end_datetime'), now)
res = query.query.Query().searchResults(theQuery)
** TRACEBACK **
File "/Users/ludvig/project/grok/YHGuiden/src/yhguiden/yhguiden_web_editorial_promo.py", line 143, in render
res = query.query.Query().searchResults(theQuery)
File "/Users/ludvig/.buildout/eggs/hurry.query-0.9.2-py2.5.egg/hurry/query/query.py", line 20, in searchResults
results = query.apply()
File "/Users/ludvig/.buildout/eggs/hurry.query-0.9.2-py2.5.egg/hurry/query/query.py", line 49, in apply
r = term.apply()
File "/Users/ludvig/.buildout/eggs/hurry.query-0.9.2-py2.5.egg/hurry/query/query.py", line 49, in apply
r = term.apply()
File "/Users/ludvig/.buildout/eggs/hurry.query-0.9.2-py2.5.egg/hurry/query/query.py", line 164, in apply
return self.getIndex().apply((self.min_value, self.max_value))
File "/Users/ludvig/.buildout/eggs/hurry.query-0.9.2-py2.5.egg/hurry/query/query.py", line 134, in getIndex
assert IFieldIndex.providedBy(index)
AssertionError
Mvh Sebastian
More information about the Grok-dev
mailing list