[Zope-CMF] Multiple search by using portal_catalog...

Tres Seaver tseaver@zope.com
Mon, 08 Apr 2002 09:58:57 -0400

josef_meile wrote:

> I just solved the problem by returning the title, subject and 
> description fields in the SearcheableText method. I don't know if it 
> is the optimal solution, but it works. Anyway, does anybody have 
> another idea?

That probably is optimal;  the intent of the SearchableText method is
to allow each content type to specify what the "default" full-text
is for searching.

> --- In zopeCMF@y..., "josef_meile" <jmeile@h...> wrote:
>>I'm looking for a search that return all the objects that contain a 
>>word in at least one (and not in all) of the following fields:
>>- Title
>>- SearcheableText
>>- Subject
>>- Description

Create a PythonScript in the root of your CMF site (or in a custom
skin folder); e.g., call it 'JosephsTextSearch', defined as::

    keywords = ' '.join( [ context.Subject() ]
    return ' '.join[ context.Title(), keywords
                   , context.SearchableText(),
                   , context.Description()

Add a TextIndex of the same name ('JosephsTextSearch'), and reindex
it (all your context objects will acquire the PythonScript as a

Finally, search against it:


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