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

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Aug 25 10:58:02 EDT 2010


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



More information about the Grok-dev mailing list