[Grok-dev] How do I look up a grok.Indexes utility so I can call methods on an index?
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.
More information about the Grok-dev