[Zope] why a xcatalog keywordindex is mandatory?

Dieter Maurer dieter at handshake.de
Sat Dec 6 16:24:35 EST 2003


Yurj wrote at 2003-12-6 12:53 -0100:
>I've this in the form input of a zcatalog query:
>
><tr><td>Collocazione AND</td>
><td><textarea name="COLL2.query:lines:record" rows="3" cols="40"></textarea>
><input type="hidden" name="COLL2.operator:record" value="and">
></td></tr>
>
>where COLL is a keywordindex. All works if I put something in the textarea.
>But if it is empty, it finds nothing instead of all, as other records.
>
>Help :)

The ZCatalog treats an empty *string* in a special way to support
search forms: an empty string is considered as "no restriction".

A ":lines" control does not return a string but a list.
An empty list is not considered as "no restriction".

What you see here, is a bug in the "AND" implementation
of "KeywordIndex". An empty list together with the "AND"
operator should be interpreted as "no restriction".
Due to the bug, it is considered as "no results".
You can use my "ManagableIndex". It comes with a "KeywordIndex"
that is correct in this respect.

  <http://www.dieter.handshake.de/pyprojects/zope>


>I've tried to change, in the form, COLL with COLL2 and do in the report
>script:
>
><dtml-call "REQUEST.set('COLL',_['COLL2'])">
>
>but it gives error (Error Type: TypeError
>Error Value: object has read-only attributes)

Did I already tell you that you *MUST* include tracebacks in
error reports? You find tracebacks in "<http://yourZope/error_log>".
The traceback tells you were the exception was raised.

I do not know your traceback (unfortunately!).
Nevertheless, I can tell you that the line above did
not cause this error.

-- 
Dieter



More information about the Zope mailing list