[Zope] Combining hits from searching 2 ZCatalogs at once

Gordon Lai klaorman@yahoo.com
Wed, 30 Apr 2003 17:38:07 -0700 (PDT)


Hi,

I'm writing a Python script that searches 2 ZCatalogs
at once with a form-provided query. The first ZCat
contains scanned images of text documents plus their
metadata. The second ZCat contains the OCR text of the
same documents. The searches are written like this:

  textresults = context.Text_Catalog(
{'PrincipiaSearchSource': query} )
  ocrresults = context.OCR_Catalog(
{'PrincipiaSearchSource': query} )

Text_Catalog is the primary catalog; it contains more
metadata than in OCR_Catalog and hits on this catalog
are preferred. OCR_Catalog is the secondary catalog;
if I get a hit here (and assuming there's no hit on
its matching document in Text_Catalog), then I want to
find its matching document and add its metadata to
textresults as a new hit. I'll then return the
modified textresults to the calling form.

My question is: How do I add the new hit to
textresults? I tried textresults.append( newhit ), but
I found out that textresults isn't a sequence, it's a
LazyCat class instance. How do I append new items to
this instance?

Thanks,
Gordon Lai




__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com