[Zope] Issues about the OR handling in Zcatalog for Zope 2.3
Ausum
augusto@artlover.com
Thu, 22 Feb 2001 14:24:17 -0500
I've tried the code from Caseman
http://www.zope.org/Members/Caseman/ZCatalog_for_2.3 and Zen
http://www.zope.org/Members/Zen/howto/AdvZCatalogSearching, and it always
happens the same: If several text fields(properties) from a same document share
a queried word, the document's record will appear repeated at least as many
times as the number of fields sharing that particular query.
The following is an example: There are four documents with 4 properties, title,
summary, body and notes, and each document has one word(query) to be queried,
included within a property, alternatively. The first document has the word
within the title, the second one within the summary, and so on.
When performing a search using the proposed code (see below), the results are as
expected: 4 records, corresponding to 4 unique appearances of the word within
each document. But if one of the documents has, ie., the same word within one
more property, the results will show 5, because its record will appear repeated.
Is there a way to eliminate the repeated records?
If the results are to be presented within one of the searched documents, how do
I eliminate that current record from the search result?
I find the indexing of alternatives methods based on PrincipiaSearchSource a
llitle confusing, but if there is a clear How To on this last workaround, I'm
sure I'd like to know it.
Thanks in advance,
Ausum
p.d. This is the code I tried:
>From Zen (for Zope prior to 2.3):
<dtml-let resa="catalog(title=query)"
resb="catalog(summary=query)"
resc="catalog(body=query)"
resd="catalog(notes=query)"
res="resa[:_.len(resa)] + resb[:_.len(resb)] + resc[:_.len(resc)]
+ resd[:_.len(resd)] ">
<dtml-in res>
<a href="<dtml-var "catalog.getpath(data_record_id_)">" >
<dtml-var title></a><br>
<dtml-var summary><br>
</dtml-in>
</dtml-let>
>From Caseman (for Zope 2.3):
<dtml-in expr="catalog(title=query) + catalog(summary=query)+
catalog(body=query) + catalog(notes=query)">
<a href="<dtml-var "catalog.getpath(data_record_id_)">" >
<dtml-var title></a><br>
<dtml-var summary><br>
</dtml-in>