[Zope] ZCatalog in 2.2.x
Terry Kerr
terry@adroit.net
Wed, 30 Aug 2000 18:27:16 +1100
I am not searching from a form in that sense...I am talking about at the python
level.
I have self.searchResults({'description':'blah'}) where description is meta
data in the catalog and a textindex and 'blah' is in the Vocabulary. This
previously worked in zope2.1.6. Now in 2.2.0 and 2.2.1 it doesn't work. The
only thing way I can get searchResults() to return a non empty list is to search
using a Field index and a valid string to match with.
pja@clari.net.au wrote:
> Terry Kerr <terry@adroit.net> said:
>
> > Hi,
> >
> > I have a python product which uses a ZCatalog and CatalogAware
> > products. The catalog has a number of Field and TextIndex indexes.
> > Search the ZCatalog has worked fine when my product is instantiated in
> > 2.1.6. But now when I instantiate my product in 2.2.0 or 2.2.1,
> > searching only works when I search using a field index. Searching using
> > a textindex always results in an empty result, even tho I can see the
> > words I am searching for in the Vocabulary! Any suggestions? I have
> > tried reindexing, completey recreating the Zcatalog, recreating the
> > Vobulary and reindexing, and nothing has changed the behaviour. Are
> > textindexes simply broken?
> >
> >
> > ZCatalog seems very volatile to me! Every time I have upgraded way back
> > from zope2.1.3, something in zcatalog has changed and boken my product.
> > So far I have managed to find fixes, but this one has got me baffled!!
> >
>
> My experience has been that if field indexes are unspecified, the catalog
> will only match where those fields are empty. In other words, by not
> specifing anything for the field indexes, you are actually specifying that
> for a match, they need to be empty.
> To get around this, I put another method between the form for entering what
> you wish to search for, and the method that actually searches the form. This
> method looks at the field indexes, and if nothing has been specified, it
> doesn't pass them on to the method that does the actual search.
> An alternative to this, is to use names for the field indexes that aren't in
> the catalog index, and then at the start of the search method, check those
> names, and if they have a value associated with them, add to REQUEST what the
> names in the index are with the appropriate values.
>
> There may be a better way, I'm still pretty new to Zope and DTML sort of
> stuff.
>
> Peter Armstrong
--
Terry Kerr (terry@adroit.net)
Adroit Internet Solutions Pty Ltd (www.adroit.net)
Phone: +613 9563 4461
Fax: +613 9563 3856
Mobile: +61 414 938 124
ICQ: 79303381