4feb6a4736
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>
327 lines
16 KiB
Text
327 lines
16 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %]
|
|
catalog › Advanced search
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript" language="javascript">//<![CDATA[
|
|
$(document).ready(function() {
|
|
$('#advsearches').tabs();
|
|
});
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body id="advsearch"><div id="doc3" class="yui-t7">
|
|
<div id="bd">
|
|
[% INCLUDE 'masthead.inc' %]
|
|
<div id="yui-main">
|
|
<form action="/cgi-bin/koha/opac-search.pl" method="get">
|
|
<div class="yui-g">
|
|
[% IF ( if_expanded_options_actually_worked ) %]
|
|
<div id="databases" class="container"> [% IF ( outer_servers_loop ) %]
|
|
<!-- DATABASES -->
|
|
<fieldset>
|
|
<legend>Select local databases:</legend>
|
|
[% FOREACH outer_servers_loo IN outer_servers_loop %]
|
|
[% FOREACH inner_servers_loo IN outer_servers_loo.inner_servers_loop %]
|
|
|
|
[% IF ( inner_servers_loo.checked ) %]<input type="checkbox" id="[% inner_servers_loo.id %]" name="[% inner_servers_loo.name %]" checked="[% inner_servers_loo.checked %]" value="[% inner_servers_loo.value %]" />[% ELSE %]
|
|
<input type="checkbox" id="[% inner_servers_loo.id %]" name="[% inner_servers_loo.name %]" value="[% inner_servers_loo.value %]" />[% END %]
|
|
<label for="[% inner_servers_loo.id %]"><img width="16" height="16" alt="[% inner_servers_loo.id %]" src="[% themelang %]/images/[% inner_servers_loo.icon %]" /> [% inner_servers_loo.label %]</label>
|
|
[% END %]
|
|
[% END %]
|
|
</fieldset>
|
|
<!-- /DATABASES -->
|
|
[% END %]
|
|
|
|
[% IF ( outer_sup_servers_loop ) %]
|
|
<!-- REMOTE DATABASES -->
|
|
<fieldset>
|
|
<legend>Select remote databases:</legend>
|
|
[% FOREACH outer_sup_servers_loo IN outer_sup_servers_loop %]
|
|
[% FOREACH inner_sup_servers_loo IN outer_sup_servers_loo.inner_sup_servers_loop %]
|
|
|
|
[% IF ( inner_sup_servers_loo.checked ) %]<input type="checkbox" id="[% inner_sup_servers_loo.id %]" name="[% inner_sup_servers_loo.name %]" checked="[% inner_sup_servers_loo.checked %]" value="[% inner_sup_servers_loo.value %]" /><input type="checkbox" id="[% inner_sup_servers_loo.id %]" name="[% inner_sup_servers_loo.name %]" value="[% inner_sup_servers_loo.value %]" />
|
|
[% END %]
|
|
<label for="[% inner_sup_servers_loo.id %]"><img alt="[% inner_sup_servers_loo.id %]" src="[% themelang %]/images/[% inner_sup_servers_loo.icon %]" />[% inner_sup_servers_loo.label %]</label>
|
|
[% END %]
|
|
[% END %]
|
|
</fieldset>
|
|
<!-- /REMOTE DATABASES -->
|
|
[% END %]</div>
|
|
[% END %]
|
|
|
|
<!-- BOOLEAN SEARCH OPTIONS -->
|
|
<div id="booleansearch" class="container"><fieldset>
|
|
<legend>Search for:</legend>
|
|
[% FOREACH search_box IN search_boxes_loop %]
|
|
<p>
|
|
[% IF ( expanded_options ) %]
|
|
[% IF ( search_box.boolean ) %]
|
|
<select name="op">
|
|
<option value="and" selected="selected">and</option>
|
|
<option value="or">or</option>
|
|
<option value="not">not</option>
|
|
</select>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( expanded_options ) %][% left_content %][% END %]
|
|
<select name="idx">
|
|
<option value="kw">Keyword</option>
|
|
<option value="su,wrdl">Subject</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="su,phr"> Subject phrase</option>
|
|
<option value="su-br"> Subject and broader terms</option>
|
|
<option value="su-na"> Subject and narrower terms</option>
|
|
<option value="su-rl"> Subject and related terms</option>
|
|
[% END %]
|
|
<option value="ti">Title</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="ti,phr"> Title phrase</option>
|
|
<option value="se,wrdl">Series title</option>
|
|
<option value="callnum">Call number</option>
|
|
<option value="location">Shelving location</option>
|
|
[% END %]
|
|
<option value="au,wrdl">Author</option>
|
|
|
|
[% IF ( expanded_options ) %]
|
|
<option value="au,phr"> Author phrase</option>
|
|
<option value="cpn,wrdl"> Corporate name</option>
|
|
<option value="cfn,wrdl"> Conference name</option>
|
|
<option value="cfn,phr"> Conference name phrase</option>
|
|
<option value="pn,wrdl"> Personal name</option>
|
|
<option value="pn,phr"> Personal name phrase</option>
|
|
[% END %]
|
|
[% IF ( expanded_options ) %]
|
|
<option value="nt">Notes/Comments</option>
|
|
<option value="curriculum">Curriculum</option>
|
|
[% END %]
|
|
<option value="pb,wrdl">Publisher</option>
|
|
<option value="pl,wrdl">Publisher location</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="sn">Standard number</option>
|
|
<option value="nb"> ISBN</option>
|
|
<option value="ns"> ISSN</option>
|
|
<option value="lcn,phr"> Call number</option>
|
|
[% ELSE %]
|
|
<option value="nb">ISBN</option>
|
|
[% END %]
|
|
<option value="bc">Barcode</option>
|
|
</select>
|
|
<input type="text" size="30" name="q" title="Enter search terms" value="" />
|
|
[% IF ( expanded_options ) %]
|
|
<!-- [% IF ( search_box.scan_index ) %]<input type="checkbox" name="scan" id="scan" value="1" /> Scan Indexes[% END %] -->
|
|
[% IF ( search_box.add_field ) %]<a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a>[% END %]
|
|
[% END %]
|
|
</p>
|
|
[% END %]
|
|
|
|
</fieldset></div>
|
|
</div>
|
|
<div class="yui-g"><div class="container" style="text-align: center;"><!-- SEARCH BUTTONS -->
|
|
|
|
<input class="submit" type="submit" accesskey="s" name="do" title="Search" value="Search" />
|
|
[% IF ( expanded_options ) %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=0">[Fewer options]</a>
|
|
[% ELSE %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=1">[More options]</a>
|
|
[% END %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?do=Clear">[New search]</a>
|
|
|
|
<!-- /SEARCH BUTTONS --></div></div>
|
|
<div class="yui-g">
|
|
<div id="pubrange" class="container">
|
|
<fieldset>
|
|
<!-- PUB RANGE OPTION -->
|
|
<legend>Publication date range:</legend>
|
|
<span>For example: 1999-2001. You could also use "-1987" for everything published before 1987 or "2008-" for everything published after 2008.</span>
|
|
<input type="text" size="30" name="limit-yr" title="Enter search terms" value="" />
|
|
</fieldset>
|
|
<!-- /PUB RANGE OPTION -->
|
|
</div>
|
|
</div>
|
|
<div class="yui-g">
|
|
<div id="advsearches" class="toptabs">
|
|
<ul>
|
|
[% FOREACH advsearchloo IN advancedsearchesloop %]
|
|
<li id="advsearch-tab-[% advsearchloo.advanced_search_type %]">
|
|
<a href="#advsearch-[% advsearchloo.advanced_search_type %]">
|
|
[% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]Item type
|
|
[% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]Collection
|
|
[% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]Shelving location
|
|
[% ELSE %]Something else
|
|
[% END %]
|
|
</a>
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
<!-- /BOOLEAN SEARCH OPTIONS -->
|
|
[% FOREACH advsearchloo IN advancedsearchesloop %]
|
|
<div id="advsearch-[% advsearchloo.advanced_search_type %]" class="container advsearch">
|
|
<fieldset>
|
|
<legend>Limit to any of the following:</legend>
|
|
<table>
|
|
<tr>
|
|
[% FOREACH itemtypeloo IN advsearchloo.code_loop %]
|
|
<td><input type="checkbox" id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" name="limit" value="mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %]"/><label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtypeloo.imageurl ) %]<img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />[% END %] [% END %]
|
|
[% itemtypeloo.description %]</label></td>
|
|
[% IF ( loop.last ) %]</tr>[% ELSE %][% UNLESS ( loop.count % 5 ) %]</tr><tr>[% END %][% END %]
|
|
[% END %]
|
|
</table>
|
|
</fieldset>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
<div id="langfilter">
|
|
<fieldset><legend>Language</legend>
|
|
<!-- LANGUAGE LIMIT -->
|
|
<p><label for="language-limit">Language: </label>
|
|
<select id="language-limit" name="limit">
|
|
<option value="">No limit</option>
|
|
[% FOREACH search_languages_loo IN search_languages_loop %]
|
|
[% IF ( search_languages_loo.selected ) %]
|
|
<option value="ln,rtrn:[% search_languages_loo.iso639_2_code %]" selected="selected">[% search_languages_loo.language_description %]</option>
|
|
[% ELSE %]
|
|
<option value="ln,rtrn:[% search_languages_loo.iso639_2_code %]">[% search_languages_loo.language_description %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select></p><!-- <a href="">Show all languages</a>-->
|
|
<!-- /LANGUAGE LIMIT -->
|
|
</fieldset>
|
|
</div>
|
|
[% IF ( expanded_options ) %]
|
|
[% IF ( usmarc ) %]
|
|
<!-- SUBTYPE LIMITS -->
|
|
<div id="subtypes" class="container"><fieldset>
|
|
<legend>Subtype limits</legend><select name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any audience</option>
|
|
<option value="aud:a">Easy</option>
|
|
<option value="aud:c">Juvenile</option>
|
|
<option value="aud:d">Young adult</option>
|
|
<option value="aud:e">Adult</option>
|
|
</select>
|
|
|
|
<select name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any content</option>
|
|
<option value="fic:1">Fiction</option>
|
|
<option value="fic:0">Non fiction</option>
|
|
<option value="bio:b">Biography</option>
|
|
<option value="mus:j">Musical recording</option>
|
|
<option value="mus:i">Non-musical recording</option>
|
|
</select>
|
|
|
|
|
|
<select name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any format</option>
|
|
<option value="l-format:ta">Regular print</option>
|
|
<option value="l-format:tb">Large print</option>
|
|
<option value="l-format:fk">Braille</option>
|
|
<option value="">-----------</option>
|
|
<option value="l-format:sd">CD audio</option>
|
|
<option value="l-format:ss">Cassette recording</option>
|
|
<option value="l-format:vf">VHS tape / Videocassette</option>
|
|
<option value="l-format:vd">DVD video / Videodisc</option>
|
|
<option value="l-format:co">CD software</option>
|
|
<option value="l-format:cr">Website</option>
|
|
</select>
|
|
|
|
<select name="limit" class="subtype">
|
|
<option value="">Additional content types for books/printed materials</option>
|
|
<option value="ctype:a">Abstracts/summaries</option>
|
|
<option value="ctype:b">Bibliographies</option>
|
|
<option value="ctype:c">Catalogs</option>
|
|
<option value="ctype:d">Dictionaries</option>
|
|
<option value="ctype:e">Encyclopedias </option>
|
|
<option value="ctype:f">Handbooks</option>
|
|
<option value="ctype:g">Legal articles</option>
|
|
<option value="ctype:i">Indexes</option>
|
|
<option value="ctype:j">Patent document</option>
|
|
<option value="ctype:k">Discographies</option>
|
|
<option value="ctype:l">Legislation</option>
|
|
<option value="ctype:m">Theses</option>
|
|
<option value="ctype:n">Surveys</option>
|
|
<option value="ctype:o">Reviews</option>
|
|
<option value="ctype:p">Programmed texts</option>
|
|
<option value="ctype:q">Filmographies</option>
|
|
<option value="ctype:r">Directories</option>
|
|
<option value="ctype:s">Statistics</option>
|
|
<option value="ctype:t">Technical reports</option>
|
|
<option value="ctype:v">Legal cases and case notes</option>
|
|
<option value="ctype:w">Law reports and digests</option>
|
|
<option value="ctype:z">Treaties </option>
|
|
</select>
|
|
|
|
</fieldset></div>
|
|
[% END %]
|
|
[% IF ( UNIMARC ) %]
|
|
<div id="subtypes_unimarc" class="container"><!-- SUBTYPE LIMITS -->
|
|
[% INCLUDE 'subtypes_unimarc.inc' %]</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
<div class="yui-g">
|
|
|
|
<div class="yui-u first">
|
|
<!-- AVAILABILITY LIMITS -->
|
|
[% UNLESS ( singleBranchMode ) %]
|
|
<div id="location" class="container"><fieldset><legend>Location and availability: </legend>
|
|
|
|
<select name="limit" id="branchloop">
|
|
<option value="">All libraries</option>
|
|
[% FOREACH BranchesLoo IN BranchesLoop %]
|
|
[% IF ( BranchesLoo.selected ) %]
|
|
<option value="branch:[% BranchesLoo.value %]" selected="selected">[% BranchesLoo.branchname %]</option>
|
|
[% ELSE %]
|
|
<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
[% IF ( searchdomainloop ) %]
|
|
<p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. -->
|
|
<label for="categoryloop">Groups of libraries</label><select name="multibranchlimit" id="categoryloop">
|
|
<option value=""> -- none -- </option>
|
|
[% FOREACH searchdomainloo IN searchdomainloop %]
|
|
<option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% END %]
|
|
<div style="margin-top:.4em"><label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label></div>
|
|
</fieldset></div>
|
|
[% END %]
|
|
<!-- /AVAILABILITY LIMITS -->
|
|
</div>
|
|
<div class="yui-u">
|
|
<!-- RANK LIMITS -->
|
|
<div id="sortby" class="container"><fieldset><legend>Sort by: </legend>
|
|
<select id="sort_by" name="sort_by">
|
|
[% INCLUDE 'resort_form.inc' %]
|
|
</select></fieldset></div>
|
|
<!-- RANK LIMITS -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-g"><div class="container" style="text-align: center;"><!-- SEARCH BUTTONS -->
|
|
|
|
<input class="submit" type="submit" accesskey="s" name="do" title="Search" value="Search" />
|
|
[% IF ( expanded_options ) %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=0">[Fewer options]</a>
|
|
[% ELSE %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=1">[More options]</a>
|
|
[% END %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?do=Clear">[New search]</a>
|
|
|
|
<!-- /SEARCH BUTTONS --></div></div>
|
|
</form>
|
|
</div>
|
|
<script type="text/javascript" language="javascript">
|
|
/* This function allows to display a new field to search.
|
|
*/
|
|
function add_field() {
|
|
var ButtonPlus = document.getElementById('ButtonPlus');
|
|
var line = ButtonPlus.parentNode;
|
|
line.parentNode.appendChild(line.cloneNode(true));
|
|
line.removeChild(ButtonPlus);
|
|
}
|
|
</script>
|
|
|
|
</div>
|
|
[% INCLUDE 'opac-bottom.inc' %]
|