Re: [Zope-dev] ZCatalog stuff

2001-02-27 Thread Chris Withers

"R. David Murray" wrote:
 
 On Thu, 22 Feb 2001, Chris Withers wrote:
  Apart from that, any ideas how I'd search for a record where the indexed
  attribute is blank or the secondary sort stuff?
 
 Somebody contributed a patch for the secondary sort stuff a while back.
 Whether it still works with 2.3.0 is a good question.

Any idea where I'd find that? I may need to give it a go...

 I also remember a *long* time ago (back when I was first starting with
 zope about a year ago) someone posting a method for picking up all
 the records in a catalog with a blank value for a field.  How you'd
 find it in the mail archives, though, I have no clue, nor do I
 remember what the method involved.

Likewise with this. The only solution I can think of at the moment is to have a
seperate 'x_is_blank' index that set to 'not x', but that seems terribly
inefficient to me :-S

Any ideas gratefully recieved :-)

Chris



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] ZCatalog stuff

2001-02-22 Thread Chris Withers

Johan Carlsson wrote:
 
  Casey Duncan [EMAIL PROTECTED] wrote:
  
   Yes, you always get all the meta-data. However, does
   anyone know how the "used" argument of
   ZCatalog.searchResults works, or why you would use it?
 
  'used' tells you the names of the indexes which actually
  participated in the search (as distinct from those you
  asked for).
 
 What does this meen?
 
 Example, What's the different between:
 
   searchResults(used=(index1,index2), index1='kalle', index2='kaviar')
 
 and;

Damn, where's this documented?
I think this is _exactly_ what I've been looking for for ages, especially, I'm
guessing, that if you don't specify 'used' then:

1. It's assumed all indexes take part in the search
2. All parameters that aren't supplied are assumed to be blank, and therefore
will match anything?

Am I on the right track?

Furthermore, is there any way I can tell ZCatalog that nothing means nothing,
not everything?

For example, if I do searchResults(age=''), I want only records with a blank age
record, _not_ all the records.

Okay while I'm here, one final one.

We have the sort_on and sort_order parameters, they'll return stuff ordered
like:

Aardvark
Badger
anteater
bird

Whereas most humans would think the following would be more readable:

Aardvark
anteater
Badger
bird

I guess ZCatalog uses cmp somewhere along the line. IS there any way I can pass
in a different cmp function for a given index?

Hah, just thought of one last one ;-)

Okay, we have sort_on, which lets me sort on one index. Is there any way I can
provide a secondary sort key?

something like
searchResults(age='',sort_on=(('lastname','normal'),('firstname','normal'),'('salary','reverse')))
would eb a dream.

Wow, that turned into a ZCatalog wishlist... any ideas if any of it is
available, and if not, hwo hard it would be to achieve?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Chris Withers

Tres Seaver wrote:
 
 Chris, this necrohippophilic sadism has to stop!

Erm? I think my education is lacking... what does that mean? :-S

 "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
:-(

Apart from that, any ideas how I'd search for a record where the indexed
attribute is blank or the secondary sort stuff?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Steve Alexander

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

necrohippo philic sadism
dead-horse-loving act of deliberate harm upon

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Tres Seaver

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[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Andy McKay

 I disagree but it's not worth arguing about. However, the people who pay
my
 salary feel that way which means I care ;-)

Ive been taking the Larry Wall approach to this when people tell me the
correct way to do things:

"A Perl script is "correct" if it gets the job done before your boss fires
you."

The simple fact is many non-technical users dont give a hoot about the
underlying python reasons or computer science, its just common to see a
case-insensitive sort.

And yes it can be done in ZCatalog and dtml-in with a little fiddling.
--
  Andy McKay.



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Casey Duncan

--- Andy McKay [EMAIL PROTECTED] wrote:
  I disagree but it's not worth arguing about.
 However, the people who pay
 my
  salary feel that way which means I care ;-)
 
 Ive been taking the Larry Wall approach to this when
 people tell me the
 correct way to do things:
 
 "A Perl script is "correct" if it gets the job done
 before your boss fires
 you."
 
[snip]

Well hell, what's good enough for Perl is good enough
for... *slaps self silly*

C'mon, are you really seriously gonna back up
reasoning for Zope features by quoting Larry Wall???
8^)


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Andy McKay

 Well hell, what's good enough for Perl is good enough
 for... *slaps self silly*
 
 C'mon, are you really seriously gonna back up
 reasoning for Zope features by quoting Larry Wall???
 8^)

Why not ? (sometimes) he makes sense ;) 

--
  Andy McKay.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )