Q2: ZCatalog Intelligent Objects
Hi, Here's the second question: 2. I've seen various mentions of that fact that objects being catalogued can be intelligent about what gets catalogued, for example: stripping out HTML, but where can I find out how to produce an object that does this? Does it make a difference if it's a ZClass-based object or a python class-based object? Does it make a difference if it's CatalogAware or not? How does the 'update catalog' button interact with this? This could make a hacky-workaround for question 1: If, when an object was catalogued, it actually indexed title and body together in an index named 'text', it would solve the OR problem, but how do I do this so that it works in all the cases? cheers, and many thanks for any help :-) Chris
Chris Withers wrote:
2. I've seen various mentions of that fact that objects being catalogued can be intelligent about what gets catalogued, for example: stripping out HTML, but where can I find out how to produce an object that does this?
<deletia>
This could make a hacky-workaround for question 1: If, when an object was catalogued, it actually indexed title and body together in an index named 'text', it would solve the OR problem, but how do I do this so that it works in all the cases?
In PTK, PortalContent-derived classes have the method def SearchableText(self): "text for indexing" This returns a string concatenation of any text that should be indexed in the catalog for a search of PortalContent in the portal. The Portal's catalog is set up to index on the SearchableText attribute, as well as other Dublin Core attributes. I guess, in general, you need to define standards for getting appropriate text for indexing from you content objects, then apply these standards to your site. The query/predicates stuff in ZPatterns looks like it will be much better than this... when it lands :-) -- Steve Alexander Software Engineer Cat-Box limited
Steve Alexander wrote:
In PTK, PortalContent-derived classes have the method
def SearchableText(self): "text for indexing"
So, if I get this correctly, Catalog will index both attributes and methods(that have only the self argument?) with the same name as an index? If so, then that's cool, but undocumented, which is bad...
The query/predicates stuff in ZPatterns looks like it will be much better than this... when it lands :-)
I really should get into ZPatterns, is there any documentation yet? cheers, Chris
Chris Withers wrote:
Steve Alexander wrote:
In PTK, PortalContent-derived classes have the method
def SearchableText(self): "text for indexing"
So, if I get this correctly, Catalog will index both attributes and methods(that have only the self argument?) with the same name as an index?
I'm not sure what arguments get passed to methods by the Catalog. You could write a class to find out. <tap tap tap> Actually, I just did :-) You're right. Catalog doesn't pass in any arguments, so you can use any method that doesn't have any args without default values as an index.
If so, then that's cool, but undocumented, which is bad...
I guess that I always assumed a Catalog would index methods as well as simple attributes, because methods are just a particular kind of attribute in Python. I agree that it should be documented somewhere, though.
The query/predicates stuff in ZPatterns looks like it will be much better than this... when it lands :-)
I really should get into ZPatterns, is there any documentation yet?
http://www.zope.org/Members/pje/Wikis/ZPatterns/HomePage -- Steve Alexander Software Engineer Cat-Box limited
participants (2)
-
Chris Withers -
Steve Alexander