Query Parser merged copy / non-dynamic filters
authorBill Erickson <berick@esilibrary.com>
Mon, 21 May 2012 14:32:56 +0000 (10:32 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 22 May 2012 19:01:23 +0000 (15:01 -0400)
commit287a3e2052f5699daacddb7c536b6a15631fcf16
tree7bb4f2eaf22ff178f1a91ecb0fe88b96c8f96579
parentb90330614c99c08f67b6e51cdf2aa035edfba66b
Query Parser merged copy / non-dynamic filters

When more than one copy-level filter (e.g. locations()) is used in a
query-parser query, all but the first are ignored.  The goal of this
work is to compress multiple copy-level filters into a single filter
that represents the full collection.  Wherever possible, boolean
structures will be honored, to the extent possible for post-search
copy-level filters.

Examples:

concerto locations(1,2) locations(3,4)

==> concerto locations(1,2,3,4)

( concerto locations(3,4,5) ) || (piano locations(3,5,7) )

==> ( concerto || piano ) locations(3,4,5,6,7)

( concerto locations(3,4,5) ) && ( piano locations(3,5,7) )

==> concerto piano locations(3,5)

Note, in the last 2 examples, the final query does not exactly match the
original.  This is because copy-level filters are applied after the
initial search and cannot be executed as part of the  nested query.  The
best we can do is create a representation of the final copy-level
filter, based on the nesting, and apply it to the final result of the
nested search.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm