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

Andy McKay andym@ActiveState.com
Tue, 14 Nov 2000 09:46:39 -0800


A ZCatalog reads a classes methods, so you can only make an external method
be read if the External method is part of your ZClass. If this is the case,
simply make an external method call my_index that returns a string. Then
when object is recatalogued, ZCatalog will read that external method.


--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "daniel dias" <diask8@yahoo.com.br>
To: "Maik Röder" <roeder@berg.net>
Cc: <zope@zope.org>
Sent: Tuesday, November 14, 2000 6:43 AM
Subject: [Zope] Re: [Fwd: [Zope] Re: Advanced search in ZCatalog (Micha)]


>
> 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
>
> _______________________________________________
> 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 )
>