makeAdvancedQuery vs. ZCatalog/CatalogTool.searchResults()

Michael Hierweck <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Hallo allerseits,

ich habe versucht, umzusetzen, was Dieter Maurer vor einiger Zeit
vorgeschlagen hat:

https://mail.dzug.org/pipermail/zope/2009-April/007316.html

--------------------------------------------------------------

# Sicherstellen, dass AdvancedQuery bereits seine Patches
# aktiviert hat.

import Products.AdvancedQuery

# Patchen von ZCatalog und CatalogTool

def _searchResults(self, REQUEST=None, used=None, _merge=1, **kw):
  return self.evalAdvancedQuery(self.makeAdvancedQuery(kw))

from Products.ZCatalog.ZCatalog import ZCatalog
ZCatalog.__call__ = _searchResults
ZCatalog.searchResults = _searchResults
del ZCatalog

from Products.CMFCore.CatalogTool import CatalogTool
CatalogTool.__call__ = _searchResults
CatalogTool.searchResults = _searchResults
del CatalogTool

----------------------------------------------------------------------

# relevanter Ausschnitt aus dem Testcode

def test(context):
   brains = context.portal_catalog.searchResults(portal_type='Document')
   for brain in brains:
     print brain.Title

----------------------------------------------------------------------

Der Testcode (mit instance run test.py aufgerufen) funktioniert auch.

Die Website insgesamt funktioniert bedingt durch den Patch aber nicht
mehr, die Zope-Instanzen rechnen sich zu Tode (CPU-Zeit) und fressen den
gesamten RAM (vorher rund 800 MB pro Instanz).

Danke für Tipps

Michael



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.