[Zope-CMF] concrete example of using path in portal_catalog search?
Mark McEahern
mark@mceahern.com
Tue, 29 Oct 2002 17:23:13 -0600
[Dieter Maurer [mailto:dieter@handshake.de]]
> There is a thread on this issue (--> mailing list archives).
Aside from google, is there any way to search the archives?
http://groups.google.com/ doesn't work, I assume?
> Currently, it does not work:
>
> You can only restrict the search to a folder and its subfolders
> but not to a folder (without subfolders).
Suppose I have a path:
/a/b/c/d/e
and I want to search for NewsItems in b ONLY -- that is, if there's one in
d, I do not want it in the search results. I assume what you mean is that
it is not possible to restrict portal_catalog.searchResults via path in this
way.
Thankfully, that is not a big concern for me right now.
What I ended up having to use is a path={'query'='/foo', 'level': n}
parameter to searchResults since the folder I wanted to search resides in a
VirtualRootMonster'd folder and I didn't want to have to specify the path to
that; i.e., I used level 1 and just search the virtual path; e.g.,
<div tal:define="results python:here.portal_catalog(
portal_type='News Item',
sort_on='Date',
sort_order='reverse',
path={'query': '/newsitems', 'level': 1})">
<div tal:repeat="obj results"
tal:replace="structure python:obj.getObject().CookedBody()">
</div>
</div>
Thanks,
// mark
-