[Zope3-Users] Catalog for newbies
fbo2 at gmx.net
Thu Dec 8 10:56:20 EST 2005
On Tue, Dec 06, 2005 at 10:41:02AM -0700, Jeff Shell wrote:
> > 1. How do I search the catalog?
> catalog = zapi.getUtility(ICatalog, 'catalog', self.context)
> results = self._results = catalog.searchResults(textindexname='text to
> search for', fieldindexname=('low value', 'high value'))
I successfully managed to search my zope-site. Now I want a more
"future-proof" solution. I'd like to have a google-like search engine on my
site which means:
* Somes words needs to be typed
* A List of results is shown, containing all content objects where all
words of the search query occur.
* The search is not restricted to some special fields - I just want
*everything* to be searched.
1. Define an interface
"""Returns the objects text"""
"""Returns a name/title of the object"""
"""Returns some few words from the beginning of the content"""
2. Use a catalog and a text-index to index all ISearchable-implementing objects (field getContent,callable)
3. Write Adapters for all content-classes used on my zope-server, adapting to ISearchable
Is this a "good" idea?
One more question:
How do I use adapters in python? I've got an object implementing interface
'IFoo'. How to I turn it into an object implementing 'IBar'?
More information about the Zope3-users