[Zope-dev] ZCatalog stuff

Tres Seaver tseaver@digicool.com
Thu, 22 Feb 2001 09:16:08 -0500 (EST)


On Thu, 22 Feb 2001, Chris Withers wrote:

> Tres Seaver wrote:
> > 
> > Chris, this necrohippophilic sadism has to stop!
> 
> Erm? I think my education is lacking... what does that mean? :-S

"Beating a dead horse". :)

> > "most humeans"
> > does *not* map to "English speakers who prefer case-insensitive
> > collation."
> 
> I disagree but it's not worth arguing about. However, the
> people who pay my salary feel that way which means I care ;-)
> 
> > case-insensitive search / sort, then create a method on your
> > object which does the approprate case-flattening, and index that
> > instead of the "real" attribute.
> 
> Thanks, I always forget the flexibility of ZCatalog :-) That
> said, how hard would it be to alter ZCatalog so you could
> override the comparison function it uses? It feels like a
> ,cmp=cmp argument to the added search index consructor, then a
> self._cmp = cmp in the constructor, followed by a query and
> replace on cmp with self._cmp in the search index source. But I
> might be completely wrong :-(

The comparison function is built into the structure the  of the
index, and is not swappable "on-the-fly".  When the catalog
allows "drop-in" indexes, then you could define a
CaseInsensitifeUnIndex class which implemented the semantics you
prefer (but I still think it should be done at the application
level, as I described above).
 
> Apart from that, any ideas how I'd search for a record where
> the indexed attribute is blank or the secondary sort stuff?

"Trust the source, Luke!" is the best answer I've got.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org