[Zope-CMF] Searching CMF returns all objects

Tres Seaver tseaver@ZOPE.COM
25 Apr 2002 09:33:18 -0400


On Thu, 2002-04-25 at 07:46, Gr=E9goire Weber wrote:
> Hi,
>=20
> I've tried Tres external method which has to be corrected before runing i=
t.
> The following points have to be changed:
>=20
>   1. Delete the space in the indexes names ('Field Index' --> 'FieldIndex=
',
> etc.)
>=20
>   2. CMF installations without hotfixed metadata_tool do not have 'end',=20
>      'reverse_modified' and 'start' indexes. Delete them in the script.
>=20
>   3. instead of catalog.manage_catalogReindex() use
> catalog.refreshCatalog(clear=3D1)
>      You get some funny 'expected 4 parameters, got 1' exceptions otherwi=
se.

Thanks for the corrections;  I should've marked it as "untested". :(

>=20
> <CODE>
> from Products.CMFCore.utils import getToolByName
>=20
> def update_catalogIndexes(self, REQUEST):
>     """
>         Drop, re-add, and rebuild catalog Indexes for Zope CMF
>         sites migrated Zope 2.3 to 2.4+.
>     """
>     CMF_CATALOG_INDEXES =3D (
>         ( 'Contributors',                  'FieldIndex'   )
>         , ( 'Creator',                     'FieldIndex'   )
>         , ( 'Date',                        'FieldIndex'   )
>         , ( 'Description',                 'TextIndex'    )
>         , ( 'PrincipiaSearchSource',       'TextIndex'    )
>         , ( 'SearchableText',              'TextIndex'    )
>         , ( 'Subject',                     'KeywordIndex' )
>         , ( 'Title',                       'TextIndex'    )
>         , ( 'Type',                        'FieldIndex'   )
>         , ( 'allowedRolesAndUsers',        'KeywordIndex' )
>         , ( 'bobobase_modification_time',  'FieldIndex'   )
>         , ( 'created',                     'FieldIndex'   )
>         , ( 'effective',                   'FieldIndex'   )
>         , ( 'expires',                     'FieldIndex'   )
>         , ( 'id',                          'FieldIndex'   )
>         , ( 'in_reply_to',                 'FieldIndex'   )
>         , ( 'meta_type',                   'FieldIndex'   )
>         , ( 'modified',                    'FieldIndex'   )
>         , ( 'review_state',                'FieldIndex'   )
>         , ( 'title',                       'TextIndex'    )
>         )
>=20
>     catalog =3D getToolByName( self, 'portal_catalog' )
>=20
>     for index_name, index_type in CMF_CATALOG_INDEXES:
>         catalog.delIndex( index_name )
>         catalog.addIndex( index_name, index_type )
>=20
>     catalog.refreshCatalog(clear=3D1)
>=20
>     return 'Catalog Indexes rebuilt.'
> </CODE>
>=20
> There exitst another external method in the Extensions directory of CMFDe=
fault
> doing the same thing, but only updating three indexes. The list has to be
> comleted.

Right;  I intend to replace that method with the one you have fixed.

>=20
>=20
> Remaining Problem
> -----------------
>=20
>   Both corrected/completed external methods generate the following error
> (site with=20
>   german content containing 'Umlaute') (Zope 2.5.0):

Hmm, I think we need to delete and re-create the Vocabulary object, too.
In fact, I will CC Andreas Jung, and see if he can't get a monkey-patch
available which automates this process for any old catalog.

Tres.
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com