[Zope-CMF] Fieldindex searches very slow when anonymous.

Tres Seaver tseaver@zope.com
Mon, 08 Apr 2002 23:43:16 -0400

Arnar Lundesgaard wrote:
> Hi, we have a very difficult problem that we are hoping somebody could help us with.
> We are currently fighting an extremely frustrating ZCatalog (portal_catalog) problem.
> This is on a three week old ZOPE cvs checkout, and our system is based on CMF.
> We have a fieldindex that indexes something like 20 000+ objects with unique values.
> When an anonymous (or not authenticated) user performs a query or search like the one
> below, we get awful performance. (almost 30 sec.)
>   portal_catalog(tm_serial=somevalue) # repeated for about 50 iterations
> When the same search is performed by an authenticated user we get responsetimes of
> around one second!! This is totally baffling to us, and we cannot understand why it
> happens. Unfortunately, we are very close to launch so we don't have much time
> debugging it. 
> Is there something we have forgotten, some premise that we have overlooked.
> Sorry if this doesn't make more sense as I am *very* tired from hunting for 
> this bug right now. :-)

What is killing your query is the test for "effective range" of content.  If
your site does not use the concept (i.e., all your content has 'None' for
both its effective and expires dates), you can apply the following patch to
remove the check::

-------------- patch starts here ---------------------------------
--- CMFCore/CatalogTool.py	4 Jan 2002 19:50:04 -0000	1.22
+++ CMFCore/CatalogTool.py	9 Apr 2002 03:42:14 -0000
@@ -186,7 +186,7 @@
          user = _getAuthenticatedUser(self)
          kw[ 'allowedRolesAndUsers' ] = self._listAllowedRolesAndUsers( user )

-        if not _checkPermission(
+        if 0 and not _checkPermission(
              CMFCorePermissions.AccessInactivePortalContent, self ):
              base = aq_base( self )
              now = DateTime()
-------------- patch ends here -----------------------------------

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