[Grok-dev] How do I look up a grok.Indexes utility so I can call methods on an index?

Sebastian Ware sebastian at urbantalk.se
Wed Aug 25 11:17:23 EDT 2010


It will! :)

Mvh Sebastian

25 aug 2010 kl. 16.58 skrev Jan-Wijbrand Kolman:

> On 8/25/10 16:43 PM, Sebastian Ware wrote:
>> Thanks! Don't know if I am doing it right, but this works:
>> 
>>   # I have performed a query using hurry.query and
>>   # I have a result set called "res". Now I...
>> 
>>   # 1 Get the catalog
>>   content_catalog = getUtility(ICatalog, 'content_index')
>> 
>>   # 2 Perform the sort using the ids in the resultset
>>   tmp = content_catalog['published'].sort(res.uids, limit=10)
>> 
>>   # 3 Create a list of objects using the uidutil in the result set
>>   objs = [res.uidutil.getObject(o) for o in tmp]
>> 
>> Only wish I had understood how this works a year ago... :)
> 
> Sorry for droppping in late... With the latest hurry.query release you 
> can actually pass sort and limit and reverse arguments to 
> searchResults(). This makes your life even easier I guess.
> 
> see:
> 
>   http://pypi.python.org/pypi/hurry.query#id1
> 
> and:
> 
> 
> http://svn.zope.org/hurry.query/trunk/src/hurry/query/query.py?rev=113300&r1=112992&r2=113300
> 
> regards, jw
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list