[Zope] AND operator and ZCatalog

Michel Pelletier michel@digicool.com
Tue, 28 Nov 2000 13:08:48 -0800


The Doctor What wrote:
> 
> * Dieter Maurer (dieter@handshake.de) [001127 17:31]:
> > Bak @ kedai writes:
> >  > i have a ZCatalog that indexes news.  i use keyword index, and text index.
> >  > when i try
> >  >
> >  > <dtml-in "Catalog(publication=myPub,section=mySec,date_posted=myDate)">
> >  >   .....
> >  > it seems that the search was ORed, not ANDed.
> >  >
> >  > i hope i'm clear enough.
> > I tried it out:
> >     For me, it was definitely an AND.
> >
> > What I did:
> >   Make a search for "Meta Type=Document Template" => lots of hits.
> >   Add "Title=xxxx" to the search => no hits
> >   Add "Title=Elvis" => some hits
> >
> > as I would expect.
> 
> Those are anded, but principiasourcesearch isn't.
> 

Text indexes implicitly Or their search terms if no operator is
specified.  Don't ask me why, I don't know.

if you want to change this behavior, edit
lib/python/SearchIndex/UnTextIndex.py on or about line 451, change the
'default_operator' argument to the query method to And:

def query(self, s, default_operator = Or, ws = (string.whitespace,)):

to:

def query(self, s, default_operator = And, ws = (string.whitespace,)):


-Michel