[Zope-CMF] catalog and Subject metadata

Tres Seaver tseaver@digicool.com
Mon, 21 May 2001 07:32:59 -0400


seb bacon wrote:
> 
> * marc lindahl <marc@bowery.com> [010518 17:13]:
> > > From: Tres Seaver <tseaver@novacoxmail.com>
> > >
> > > The "Quick Search" box in the standard header only searches the
> > > "SearchableText" index, which presumably is the content's "full text".
> > > The Subject field, like the rest of the metadata, is not included in
> > > that index by default;  to remedy this, you can either:
> > >
> > > - Hack or derive from CMFCore.CatalogTool to add the desired metadata
> > > to the class at indexing time;
> > >
> > > - Hack the SearchableText method on your content classes to included
> > > the desired metadata directly.
> >
> > Couldn't you also instead of having standard_top_bar directly submit a
> > search, pass thru a DTML method that took the input box data and formed an
> > OR search of that data in all the desired fields? (the lazy concatenation
> > mentioned here http://www.zope.org/Members/Caseman/ZCatalog_for_2.3 ?)
> 
> Is there a good reason for the "Quick Search" box retrieving only
> SearchableText, e.g. it's quicker?  Otherwise, I would say this was a
> bug: at the moment, a search for 'spam' won't bring up documents whose
> subject is spam, which isn't really expected behaviour.

The catalog doesn't make "or" searches really feasible at the moment.
A workaround would be to add a new index, say 'BetterSearchableText'
to the catalog, and then write a Python Script (in the 'custom' skin,
or in the portal root) which computes it as:

   return context.SearchableText() + _.string.join( context.Subject() )

The underlying content objects already fold in Title and Description;
we could patch them to perform this same extension, too.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org