On 27.02.2014 14:58, Wagner, Alexander wrote:

Hi!

About bracket reduction: this is what I added to my code. It is not that simple 
as I generate them from othet ops.

I agree, that it would be a good idea if the query parser removes unnecessary 
brackets.  Would avoid trouble.

I'll try to build a sample against the demo site.

It seems to be fixed on the demo site, at least my trivial use cases
work there as expected. So, we'll see if all is well and gone after an
eventual upgrade.

Still it might be a good idea to add some simplify() to the query parser.

After thinking about it: probably interactive input will not trigger
this sort of error easily. It's more if you have something like "query
calculations" as in our backend use case, where I calculate the
effective query from intbitset-intersections/differences/combinations,
that one might end up with superflous brackets.

----- Reply message -----
From: "Tibor Simko" <tibor.si...@cern.ch>
Date: Thu, Feb 27, 2014 14:28
Subject: Search & Bracketing
To: "Wagner, Alexander" <a.wag...@fz-juelich.de>
Cc: "project-invenio-devel@cern.ch" <project-invenio-devel@cern.ch>

On Thu, 27 Feb 2014, Wagner, Alexander wrote:
The ind:val-example I gave, where you noticed it is perfrctly ok, is
actually broken on JuSER.

Would you have an example that fails on our demo site?

(ind:"val1" and ind:"val2") and ((ind:"val3" or ind:"val4") or
ind:"val5")

If you use this query literally, then please note that several pairs of
parentheses are not needed here, as they are chaining within the same
AND or OR sequence.  You can reduce the above to:

   ind:"val1" and ind:"val2" and (ind:"val3" or ind:"val4" or ind:"val5")

The logic being:

   (A and B) and ((C or D) or E) == A and B and (C or D or E)

It may be helpful to the query parser to always reduce the number of
incoming parentheses.

Best regards
--
Tibor Simko



--

Kind regards,

Alexander Wagner
Scientific Services / Scientific Publishing
Central Library
52425 Juelich

mail : a.wag...@fz-juelich.de
phone: +49 2461 61-1586
Fax  : +49 2461 61-6103
http://www.fz-juelich.de/zb/wp


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

Reply via email to