[Zope-CMF] Sorting Search Results by Path...

Tres Seaver tseaver@zope.com
11 Sep 2002 09:33:53 -0400


On Tue, 2002-09-10 at 20:59, Jeff Ross wrote:
> I'm creating a "My Documents" page in my portal in which each user can see
> the documents they created. I'm basing my page on search.pt. It was easy
> enough to search by the Creator field, but I can't figure out how to sort
> the results by path. I've tried adding "sort_on=path" to the query string,
> but this just gives me:
> 
> Error Value: Products.ZCatalog.Catalog.CatalogError on The index chosen for
> sort_on is not capable of being used as a sort index. in '', at line 10,
> column 1

You will need to extend your catalog:

  1. Create a new PythonScript in your 'custom' skins directory,
     'sortPath', with the body, 'return context.getPhysicalPath()'.

  2. Add a new FieldIndex, 'sortPath', to your catalog, and re-index it.

  3. Use 'sort_on="sortPath"' in your query.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com