[Zope-CMF] Searching portal_catalog using wildcards or regexp

Dieter Maurer dieter@handshake.de
Thu, 14 Nov 2002 21:40:22 +0100


Kevin Carlson writes:
 > I have searched on zope.org to no avail -- is there a way in which I may
 > query a portal_catalog for documents whose title begins with a certain
 > letter?  For example, I would like to call something like this:
 > 
 >     results = context.portal_catalog({'Title' : 'A*'})
 > 
 > and have it return a result set for all documents where the Title index
 > begins with the letter A.  Does anyone know if this can be done?
This will work when "Title" is a "TextIndex" (I think, it is).
However, it will then look for titles which contain a word beginning
with "a" and not only titles that begin with "a".

FieldIndex'es currently do not support wildcards. You would need
to implement your own index. If you do, it is easy to plug it into
the ZCatalog indexing framework.


Dieter