Give implicit operators higher precedence in QP
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Tue, 21 Aug 2012 17:53:49 +0000 (13:53 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sun, 9 Sep 2012 19:16:03 +0000 (15:16 -0400)
commitd72eaa76b2498f070cbb414b376b7566cd8c2d40
treee50159b623cb3b5c0eaf1ef040a3df8bcf40dc72
parenta21da586f1c7cd978dca57b018c3f1ca18f07336
Give implicit operators higher precedence in QP

When the implicit ANDs added by QueryParser between terms are combined
with explicit ORs without any explicit grouping, the results can be
unexpected and undesirable. For example, the following query:

  harry potter and the chamber of secrets || sorcerer's stone

Is translated into a query with two branches:
1. harry potter and the chamber of secrets stone
2. sorcerer's stone

This is of course nothing like what the user was expecting, which were
the following two branches:
1. harry potter and the chamber of secrets
2. sorcerer's stone

(Note: of course the user probably wanted to search for "harry potter
and the chamber of secrets" or "harry potter and the sorcerer's stone"
but we have to draw the line on implicit grouping somewhere, and where
it requires reading minds seems like a good place)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm