[Zope] Re: [Fwd: [Zope] Re: Advanced search in ZCatalog (Micha)]

daniel dias diask8@yahoo.com.br
Tue, 14 Nov 2000 11:42:41 -0300 (ART)


Hi,

Ok, I could achieve something with this approach. But
it's not clear for me how to set the ZCatalog to
create an index from the result of an external method.
Can you please explain how to achieve this?

Also, the ZCatalog queries use an "and" chain for each
token provided (eg. if a query is requested for "a b
c" it will be interpreted as "a" and "b" and "c"), and
I'd like to implement an "or" chain in the queries.

Thanks for the help,

Daniel

--- Maik Röder <roeder@berg.net> wrote: > 
Hi Daniel !
> 
> daniel dias wrote:
> > 
> > you've a copy of this python method to send me?
> > thanks maik!
> 
> Look at what Michael Kobald wrote:
> 
> Regards,
> 
> Maik 
> 
> michael Kobald wrote:
> > 
> > Hi,
> > I played with ZCatalog and ZClasses a time ago.
> > Due to the fact that ZCatalog can Index all
> Objects - You Can Index a
> > Method, .....!!!
> > This Methods can be External-, Phython-, or
> DTML-Methods.
> > But they have to return something to the catalog
> (DTML-RETURN Tag).
> > You can give this method a name like
> "PrincipiaSearchSource" or what the
> > hell you think of.
> > 
> > In my case I index about 10 different ZClass, 100
> Instances of them, with a
> > PythonMethod called text_inhalt (text_contents)
> > Param: self
> > Code
> > return string.join((self.id, self.inhalt), '; ')
> > 
> > Or in an  subclass
> > return string.join((self.id, self.teaser,
> self.gericht, self.keys, self.art,
> > self.norm, self.parteien), '; ')
> > 
> > Be warned you can use a DTML Method and return
> something with the
> > dtml-return tag, but this is not working very well
> within a ZCLass, !!!
> > ??????
> > 
> > P.S.:
> > If you want to call a resultObject (e.g. a ZClass)
> directly through
> > Zope/DTML/Python use the PyMethod "fetchObj" much
> cooler than only via
> > catalog.getpath (which is link /hfg/kkjk/)
> > 
> > to do somthing like this:
> > 
> > <dtml-in mein> ****Result from a canned search
> > 
> > <dtml-call
> >
>
"REQUEST.set('meineURL',fetchObj(_,Catalog.getpath(_.int(_['sequence-item'])
> > )))">****convert /parent/child to an real object
> parent.child
> > 
> > <dtml-var meineURL>  *** points to a ZClass
> [Base:Renderable] calling the
> > Object/Class directly, which renders itself
> > 
> > </dtml-in>
> > 
> > use something like this:
> > 
> > Python Method: fetchObj
> > 
> > Param: _,fetchStr, attr=None
> > 
> > obj = _
> > for p in string.split(fetchStr, '/'):
> >    obj = obj[p]
> > if attr is None:
> >    return obj
> > else:
> >    return render(_.getattr(obj, attr))
> > 
> > Greetings from Heidelberg
> > 
> > Michael Kobald
> > 
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> > 
> http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )



________________________________________________________________________
Do You Yahoo!?
Crie o seu e-mail grátis do Yahoo! Mail com 6 Megabytes livres!
http://mail.yahoo.com.br