Bug 8211: Add exploded search options
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 23 Aug 2012 23:35:22 +0000 (19:35 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 18 Sep 2012 13:20:48 +0000 (15:20 +0200)
commit4feb6a4736adbdc809cb5945269c52210e0d393d
tree42cca72cccd5d94ffd2afd60ad4d19d68a86ac8b
parent401d9e447930e229d72eae0b6874bb3cd93d0e73
Bug 8211: Add exploded search options

When working with hierarchical subject headings, it is sometimes helpful
to do a search for all records with a specific subject, plus
broader/narrower/related subjects. This patch adds support for these
"exploded" subject searches to Koha.

To test:
1) Make sure you have a bunch of hierarchical subjects. I created
   geographical subjects for "Arizona," "United States," and "Phoenix,"
   and linked them together using 551s, and made sure I had a half
   dozen records linking to each (but not all to all three).
2) Do a search for su-br:Arizona (or choose "Subject and broader terms"
   on the advanced search screen with "more options" displayed), and
   check that you get the records with the subject "Arizona" and the
   records with the subject "United States"
3) Do a search for su-na:Arizona (or choose "Subject and narrower terms"
   on the advanced search screen with "more options" displayed), and
   check that you get the records with the subject "Arizona" and the
   records with the subject "Phoenix"
4) Do a search for su-rl:Arizona (or choose "Subject and related terms"
   on the advanced search screen with "more options" displayed), and
   check that you get the records with the subject "Arizona," the
   records with the subject "United States," and the records with the
   subject "Phoenix"
5) Ensure that other searches still work (keyword, subject, ccl,
   whatever)
6) Sign off

Technical details:
This patch adds a shim in front of C4::Search::buildQuery in order to
preprocess the query and call the _handle_exploding_search callback.
This shim will allow us to gradually offload query parsing to a new
query parser module.

Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Search.pm
koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc
koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt
t/db_dependent/Search.t