[Zope] Zcatalog search

2000-11-17 Thread Brown Fox

Hello,
i've indexed some dtml-documents with some metadata,
for example a CPU field.
I can search for a CPU or any other metadata, but
how i can have the list of all the objects with a CPU
property?

Thanks,

   Bruno



__
Do You Yahoo!?
Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] ZCatalog Search Q

2000-06-30 Thread Leonard Chan

Hi,

I'm trying to search a catalog and return a list of hits, 
and here is a code fragment:

dtml-in Catalog
 a href="dtml-var "Catalog.getpath(data_record_id_)""
  dtml-var title
 /a
 dtml-var idbr
/dtml-in

This works ok, however, I understand that the catalog search 
does not actually return object references to the actual 
objects catalogued.

I'd like to include some attributes from the actual objects 
(maybe by accessing the actual object via id, etc?) in the 
result list.
 
Can someone let me know how to do that?  I can of course include those attributes in 
the catalogue meta table so they  would be returned with the search results, but I 
don't really 
want to do that unless there is no other way.

Thanks for any info/help.

Rgds
Len



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] ZCatalog Search Q

2000-06-30 Thread Chris Withers

Leonard Chan wrote:
 I'd like to include some attributes from the actual objects
 (maybe by accessing the actual object via id, etc?) in the
 result list.

You can get the actual object with:

Catalog.getobject(data_record_id_) inside your dtml-in loop.

This is supposedly a 'bad' thing to do but there's nothing better right
now...

  I can of course include those attributes in the catalogue meta table so they  would 
be returned with the search results, but I don't really
 want to do that unless there is no other way.

Well, it might be the best way. Why?

...because otherwise you have to load up the whole object to get the
attributes you want. If there's only a few attributes like this, which
are small anyway, and your objects are large, then your wastign a load
of RAM you don't need to be.

HTH,

cheers,

Chris

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] ZCatalog Search Q

2000-06-30 Thread Chris Withers

Leonard Chan wrote:
  This is supposedly a 'bad' thing to do but there's nothing better right now...
 
 Why is this a 'bad' thing?  'Cause it requires loading the whole object?

Nope, 'cos it doesn't work with anything that plays with traversal, like
SiteAccess. Something better should be coming along in Zope 2.2 but it
probably won't be documented until Zope 3 :(

 Yes. Our situation is like this.  We have a bunch of objects (ZClass) in
 various folders, and we would like to provide a dynamic search facility
 for the users (in addition to traversing folders and sub-folders, which
 is not a problem).
 
 The object has a description field, which is a few lines of text (there
 is a long description field, which varies from zero length to up to 10
 times the size of the desc).
 
 We need to display the description field (but not the long desc) on the
 search results, so to implement this, we can either stick the desc in
 the catalog meta-table, or use getobject as you suggested to retrieve
 the object (and hence the required attributes).
 
 Initially, I'm a bit worried about sticking the desc in the meta-table
 'cause it's relatively big compared to the other attributes.  Maybe it's
 still cheaper than getting the object (which includes the much bigger
 long desc field) every time?  Seen similar situation before?  Any help
 is appreciated.

Well, given that it's going to be easier and cleaner for you to put it
in the metadata table I'd d othat. I can really see any problems with
this.

I'm sure someone else on the list will comment if they know better...

cheers,

Chris

___
Zope maillist  -  [EMAIL PROTECTED]
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 )