[daisy] Evaluation of a boolean field in a query restriction
part returns an error (Daisy 1.5.1)
Bruno Dumon
bruno at outerthought.org
Wed Mar 14 15:00:29 CDT 2007
On Wed, 2007-03-14 at 18:07 +0100, Olivier Lange wrote:
> Hello,
>
> I am using Daisy 1.5.1 and I just noticed that the following query:
>
> SELECT name WHERE( documentType = 'Even')
> AND( $EvenEnfants = true)
>
> where $EvenEnfants is a field of type Boolean (single value, no selection list, no ACL allowed), returns an error:
>
> Received exception from repository server.
> Error performing query.
> Error parsing expression.
> Expected a value expression at the right-hand side of comparison operator "=" at line 2, column 19
>
> The boolean field 'EvenEnfants' is required within the 'Even' document type.
>
> I tried to rewrite the query, for instance:
>
> SELECT name WHERE( documentType = 'Even')
> AND( $EvenEnfants = 1)
>
> but got an error in any case; for the above:
>
> Received exception from repository server.
> Error performing query.
> Invalid boolean value: "1" (should be 'true' or 'false').
>
> Is this a bug, a known issue? Is there a workaround? I've been searching in the mailing list archives and JIRA without luck.
Hi,
The correct syntax is:
$EvenEnfants = 'true'
thus the single quotes should be included.
The reason for this is implementation history: there's currently a
difference between 'value expressions' (which can be compared using
things like =, <, ... and given as arguments to functions) and
'predicate expressions' which are true or false and can only be and-ed
or or-ed. The token "true" happens to be a predicate expression (it was
introduced to be able to search for all documents: "where true"). This
will probably be refactored in the future.
I've adjusted the exception message to tell the quotes should be
included.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list