[Zope-CMF] Search results with portal_catalog - need a strategy

Raphael Ritz r.ritz@biologie.hu-berlin.de
Tue, 01 Jul 2003 11:18:17 +0200


Peter McMillan wrote:

>Dieter,
>
>I've been continuing to work on getting all the results back from a standard
>portal search.
>
>I had deleted an index named SearchableText. I've recreated it as a
>ZCTextIndex searching on the Title field.
>
>Now I'm getting back pretty good search results...
>
>I don't completely understand the significance of why having an index named
>SearchableText works. I'm assuming this is because the portal search form
>uses SearchableText as the name of the input field?
>
You migth benefit from some background reading on the ZCatalog like this:
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/SearchingZCatalog.stx

For the generel perspective this may help:
(taken from http://www.neuroinf.de/Miscellaneous/BeginnersGuide)
...
The ZCatalog

This is what you need in order to search the database (effectively). For 
plain Zope you need to build one yourself whereas CMF/Plone come with a 
pre-configured portal_catalog. There are some issues that aren't obvious 
at the beginning, like indexes, brains, and meta data so I sketch them here.

    * Index: You can query the catalog only on an index and there are
      several types of indexes supporting different functionality, e.g.,
      on field indexes you can sort (and do range searches) whereas on
      text indexes you can't sort but enable globbing (using wildcards).
    * brains: The catalog does not hold (copies of) the objects indexed
      themself but rather a reference object to them called brain or
      catalog brain in Zope terminology. Brains provide methods like
      getObject() or getURL() to get at the respective object or its
      URL. Furthermore brains can be equiped with
    * catalog meta data to have some attribute values or results of
      method calls to the object availabel right away (without having to
      access the object). It's up to you how many meta data you want (or
      can afford) to put on your brains. You basically trade disc space
      for performance

...

The upshot is that any object that provides an attribute or method with 
the name
of the index (here SearchableText) gets indexed with the value/outcome 
of this
attribute/method. Content types in the CMF may provide their own 
SearchableText
method but if not it is inherited (typically from PortalContent where it 
is defined
to return the title and the description).

HTH,

    Raphael

>
>Can anyone enlighten me on this one?
>
>Thanks,
>
>Peter
>
>On 6/26/03 3:21 PM, "Dieter Maurer" <dieter@handshake.de> wrote:
>
>  
>
>>Peter McMillan wrote at 2003-6-24 15:49 -0700:
>>    
>>
>>>On 6/23/03 10:04 AM, "Dieter Maurer" <dieter@handshake.de> wrote:
>>>[snip]
>>>      
>>>
>>>>I (in your place) would use a debugger to find out why the catalog
>>>>returns apparently wrong results.
>>>>        
>>>>
>
>
>_______________________________________________
>Zope-CMF maillist  -  Zope-CMF@zope.org
>http://mail.zope.org/mailman/listinfo/zope-cmf
>
>See http://collector.zope.org/CMF for bug reports and feature requests
>
>  
>