[Zope3-Users] Searching Content Objects

Jeff Shell eucci.group at gmail.com
Mon Jul 25 00:02:03 EDT 2005


Create a browser view object with a method that looks up the catalog
utility and performs the search and returns results back to the
template. Basically take what you've learned about writing views that
combine classes and templates, and use code like the following:

    def search(self, query):
        """simple example, query is just a string"""
        catalog = zapi.getUtility(ICatalog, 'catalog', self.context)
        return catalog.searchResults(some_index=query)

Of course, you could take in more search parameters from the form and
pass those in as well.

On 7/24/05, Jim Vine <jim_a_vine at yahoo.co.uk> wrote:
> Hi,
> 
> Thanks a lot for the pointer. I have upgraded to Zope
> 3.1b (with only minor difficulty).
> 
> I've read the readme for Catalog, and I think I more
> or less follow how it works. What I didn't pick up
> from the readme, however, was how I would actually use
> it in an application. How does one go about generating
> a search form that accepts a few criteria, and has a
> "submit" button, that would then go off and fetches
> the results?
> 
> Thanks,
> Jim
> 
> 
> --- Stephan Richter <srichter at cosmos.phy.tufts.edu>
> wrote:
> 
> > On Saturday 23 July 2005 16:17, Jim Vine wrote:
> > > It seems from the documentation that ZCatalog is
> > the
> > > prefered way of doing a search in Zope 2, but that
> > > this isn't implemented in Zope 3.
> >
> > Use Zope 3.1 beta 1; it has indices and a catalog
> > implementation.
> >
> > Regards,
> > Stephan
> > --
> > Stephan Richter
> > CBU Physics & Chemistry (B.S.) / Tufts Physics
> > (Ph.D. student)
> > Web2k - Web Software Design, Development and
> > Training
> >
> 
> 
> 
> 
> 
> 
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>


More information about the Zope3-users mailing list