[Zope] portal_catalog or TextindexNG bug?
BALTUS Jean
jean.baltus at africamuseum.be
Thu Jul 15 03:25:14 EDT 2004
Thanks for your input Lupa. I agree with you. However, I'm facing a
metadata element and not an index. So (to me) acquisition should not take
place here.
If what you said is also valid for metadata elements, it means that you
can NEVER call an object the same name as a metadata element?? !!! (Hard
to achieve in a big Plone site...)
-- Jean
-----Original Message-----
From: +lupa+ [mailto:lupa at zurven.com]
Sent: 15 July 2004 00:05
To: BALTUS Jean; zope at zope.org
Subject: [Zope] portal_catalog or TextindexNG bug?
>Jean wrote:
>I have the name 'country' in our metadata lists. On our website, I
>noticed we also have a ZSQL method named 'country' in a subfolder
>somewhere.
>
>It seems that the portal_catalog tries to call this ZSQL method when
>retrieving items with a 'country' attribute. If I delete the ZSQL method
>and update the Catalog, everything goes back to normal.
>
>Seems like a bug to me... If you name a ZSQL method with a name
>registered in your metadata list, the portal_catalog produces the
>traceback. I don't know whether it's a portal_catalog bug or a
>TextIndexNG bug.
This is not a bug per se, but rather a *feature* of acquisition. Spammish
acquisition may be at times, when acquisition finds something we don't
expect, but that's why names are important in Zope, and why acquisition is
such a powerful ally in Zope programming.
I have used this behavior successfully to create an index on a derived
attribute, rather than on a simple named attribute. Simply create the
index on the name of a script, and write a script that returns the value
you want indexed. The catalog runs the script against each object it
catalogs, rather than simply pulling the attribute with that name (pick a
name for your script and index that is NOT an attribute name of your
objects). This allows you to be creative in creating an index that
contains
exactly what you want, rather than be tied by name to an attribute.
Uses? For example, the catalog will try to run the script against every
object, but your script can return values only for the type of object that
you want it to. For another, you can create a text index that consists of
the combined text from several fields into one.
+lüpa+ CalendarX.org CalendarX-0.2.7(alpha) at Sourceforge
###########################################
This message has been scanned by ICT - Africa Museum
More information about the Zope
mailing list