[Zope] ZCatalog question

Martijn Pieters mj@digicool.com
Thu, 13 Jan 2000 03:42:27 -0500


> -----Original Message-----
> From: scott kaplan [mailto:skaplan@wso.williams.edu]
> 
> Hi all,
> This may be a dumb question but I have perused the docs and 
> can't seem to
> find an answer. I am trying to catalog an attribute that 
> doesn't seem to
> be either a field index or a text index.
> 
> Lets say my example attribute is a list of subjects, and when 
> I search for
> a document, I want to get documents of a certain subject.  So I have a
> document that I want to appear under "Help" and "Monkeys" and in
> themselves I want to treat the subjects atomically (Field 
> Index) , but I
> want more than one for each document (more TextIndexish, but 
> not quite).
> 
> So I was wondering can I do this with ZCatalog or sohuld I do it with
> other python logic.

Sounds like a perfect fit for a Keyword Index. Keyword indexes have been
added in Zope 2.1.0 beta 1. From the CHANGES.txt file:

  Keyword indexes allow you to index a sequence of 
  'keywords' as an atomic property of an object. This 
  is useful for building categorical hierarchies.

With a Keyword index, you index a sequences, so anything that's a list
or a tuple. Each element of that sequence is treated like a Field in a
FieldIndex. So, if your object has a property 'subjects' that returns a
list of 'Help' and 'Monkeys', a search for a subject of either one of
these will return that object.

HTH

-- 
Martijn Pieters, Software Engineer 
| Digital Creations http://www.digicool.com 
| Creators of Zope      http://www.zope.org 
| mailto:mj@digicool.com       ICQ: 4532236
| PGP:
http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
-------------------------------------------