5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Advanced search › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %][% END %]
10 [% INCLUDE 'bodytag.inc' bodyid='advsearch' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
12 <form action="/cgi-bin/koha/opac-search.pl" method="get">
13 <input type="hidden" name="advsearch" value="1"/>
15 <nav aria-label="breadcrumb">
16 <ul class="breadcrumb">
17 <li class="breadcrumb-item">
18 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
20 <li class="breadcrumb-item active" aria-current="page">
21 <a href="#">Advanced search</a>
26 <div class="container-fluid">
28 <div class="col order-first order-md-first order-lg-2">
29 <!-- BOOLEAN SEARCH OPTIONS -->
30 <div id="booleansearch" class="maincontent">
31 <h1>Advanced search</h1>
33 <legend>Search for:</legend>
34 [% IF ( expanded_options ) %]
35 <div class="advanced-search-terms extended">
37 <div class="advanced-search-terms">
38 [% END # /IF ( expanded_options ) %]
39 [% FOREACH search_box IN [ 1, 2, 3] %]
40 <div class="search-term-row">
41 <div class="search-term-input">
42 [% IF ( expanded_options ) %]
43 <select name="op" class="form-control">
44 <option value="and" selected="selected">and</option>
45 <option value="or">or</option>
46 <option value="not">not</option>
49 <label for="search-field_[% loop.index | html %]">
50 [% IF loop.index == 0 %]
51
56 [% END # /IF ( expanded_options ) %]
57 </div> <!-- .search-term-input -->
59 <div class="search-term-input">
60 <select class="form-control" name="idx" id="search-field_[% loop.index | html %]">
61 <option value="kw">Keyword</option>
62 [% IF ( expanded_options ) %]
63 <option value="kw,phr"> Keyword phrase</option>
65 <option value="su,wrdl">Subject</option>
66 [% IF ( expanded_options ) %]
67 <option value="su,phr"> Subject phrase</option>
68 <option value="su-br"> Subject and broader terms</option>
69 <option value="su-na"> Subject and narrower terms</option>
70 <option value="su-rl"> Subject and related terms</option>
72 <option value="ti">Title</option>
73 [% IF ( expanded_options ) %]
74 <option value="ti,phr"> Title phrase</option>
75 <option value="se,wrdl">Series title</option>
76 [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
77 <option value="callnum,phr">Call number</option>
79 <option value="callnum">Call number</option>
83 <option value="au,wrdl">Author</option>
84 [% IF ( expanded_options ) %]
85 <option value="au,phr"> Author phrase</option>
86 <option value="cpn,wrdl"> Corporate name</option>
87 <option value="cfn,wrdl"> Conference name</option>
88 <option value="cfn,phr"> Conference name phrase</option>
89 <option value="pn,wrdl"> Personal name</option>
90 <option value="pn,phr"> Personal name phrase</option>
92 [% IF ( expanded_options ) %]
93 <option value="nt">Notes/Comments</option>
94 [% IF (marcflavour != 'UNIMARC') %]
95 <option value="curriculum">Curriculum</option>
98 <option value="pb,wrdl">Publisher</option>
99 <option value="pl,wrdl">Publisher location</option>
100 [% IF ( expanded_options ) %]
101 [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
102 <option value="ident,phr">Standard number</option>
104 <option value="ident">Standard number</option>
106 <option value="nb"> ISBN</option>
107 <option value="ns"> ISSN</option>
109 <option value="nb">ISBN</option>
111 <option value="bc">Barcode</option>
112 </select> <!-- /#search-field_[% loop.index | html %] -->
113 </div> <!-- .search-term-input -->
114 <div class="search-term-input">
115 <input class="form-control" type="text" size="" name="q" title="Enter search terms" value="" />
116 </div> <!-- .search-term-input -->
117 [% IF ( expanded_options ) %]
118 <div class="search-term-input">
119 <a class="ButtonPlus" title="Add another field" href="#">
120 <i class="fa fa-plus-square" aria-hidden="true"></i>
122 <a class="ButtonLess" title="Remove field" href="#">
123 <i class="fa fa-minus-square" aria-hidden="true"></i>
125 </div> <!-- .search-term-input -->
127 </div> <!-- /.search-term-row -->
128 [% END # FOREACH search_box %]
129 [% IF ( expanded_options ) %]
130 [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
131 <div id="weight_search">
133 <input type="checkbox" name="weight_search" checked="checked">
134 Apply field weights to search
139 <input type="hidden" name="weight_search" value="1" />
141 </div> <!-- /.search-terms -->
143 </div> <!-- /#booleansearch -->
144 </div> <!-- / .col -->
145 </div> <!-- / .row -->
147 <div class="text-center">
148 <!-- SEARCH BUTTONS -->
149 <fieldset class="action">
150 [% PROCESS searchbuttons %]
152 <!-- /SEARCH BUTTONS -->
156 [%# Following on one line for translatability %]
157 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
158 <div class="col order-first order-md-first order-lg-2">
159 <div id="advsearches" class="toptabs">
161 [% FOREACH advsearchloo IN advancedsearchesloop %]
162 <li id="advsearch-tab-[% advsearchloo.advanced_search_type | html %]">
163 <a href="#advsearch-[% advsearchloo.advanced_search_type | uri %]">
164 [% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]Item type
165 [% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]Collection
166 [% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]Shelving location
167 [% ELSE %]Something else
173 [% FOREACH advsearchloo IN advancedsearchesloop %]
174 <div id="advsearch-[% advsearchloo.advanced_search_type | html %]" class="advsearch">
176 <legend>Limit to any of the following:</legend>
178 [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
179 [% IF (advsearchloo.advanced_search_type != 'itemtypes') OR (((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1)) %]
180 <div class="col-sm-6 col-lg-3">
181 <input type="checkbox"
182 id="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]"
183 name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
184 value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code | html %][% ELSE %]mc-[% itemtypeloo.ccl | html %]:[% itemtypeloo.code | html %][% END %]"
186 <label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
187 [% UNLESS ( Koha.Preference('OpacNoItemTypeImages')) %]
188 [% IF ( itemtypeloo.imageurl ) %]
189 <img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
193 [% itemtypeloo.description | html %]
196 [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row">[% END %][% END %]
200 </div> <!-- / #advsearch-[% advsearchloo.advanced_search_type | html %] -->
201 [% END # / FOREACH advancedsearchesloop %]
202 </div> <!-- / #advsearches -->
203 </div> <!-- / .col -->
204 [% END # /IF OpacAdvSearchOptions %]
207 <div id="advsearch_limits" class="row">
209 [%# Following on one line for translatability %]
210 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %]
211 [% IF ( singleBranchMode ) %]
212 <div class="col-sm-6 col-lg-3">
213 <!-- AVAILABILITY LIMITS -->
214 <div id="location" class="advsearch_limit">
216 <legend>Availability: </legend>
217 <div style="margin-top:.4em">
218 <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
221 </div> <!-- / #location -->
222 <!-- /AVAILABILITY LIMITS -->
223 </div> <!-- / .col -->
225 <div class="col-sm-6 col-lg-3">
226 <!-- AVAILABILITY LIMITS -->
227 <div id="location" class="advsearch_limit">
229 <label for="branchloop">Location and availability:</label>
230 <select name="limit" id="branchloop">
231 <option value="">All libraries</option>
232 [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
233 [% IF BranchesLoo.selected %]
234 <option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option>
236 <option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option>
240 [% IF search_groups %]
242 <label for="categoryloop">Groups of libraries</label>
243 <select name="limit" id="categoryloop">
244 <option value=""> -- none -- </option>
245 [% FOREACH sg IN search_groups %]
246 <option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option>
250 <div style="margin-top:.4em">
251 <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
254 </div> <!-- / #location -->
255 <!-- /AVAILABILITY LIMITS -->
256 </div> <!-- / .col -->
257 [% END # / IF singleBranchMode %]
260 [%# Following on one line for translatability %]
261 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
262 <div class="col-sm-6 col-lg-3">
264 <div id="sortby" class="advsearch_limit">
266 <label for="sort_by">Sort by:</label>
267 <select id="sort_by" name="sort_by">
268 [% INCLUDE 'resort_form.inc' %]
273 </div> <!-- / .col -->
276 [%# Following on one line for translatability %]
277 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
278 <div class="col-sm-6 col-lg-3">
279 <div id="pubrange" class="advsearch_limit">
280 <!-- PUB RANGE OPTION -->
282 <label for="limit-yr">Publication date range</label>
283 <input type="text" size="30" id="limit-yr" name="limit-yr" title="Enter search terms" value="" />
284 <div class="hint">For example: 1999-2001. You could also use "-1987" for everything published in and before 1987 or "2008-" for everything published in 2008 and after.</div>
286 <!-- /PUB RANGE OPTION -->
291 [%# Following on one line for translatability %]
292 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
293 <div class="col-sm-6 col-lg-3">
294 <div id="langfilter" class="advsearch_limit">
296 <!-- LANGUAGE LIMIT -->
297 <label for="language-limit">Language</label>
298 <select id="language-limit" name="limit">
299 <option value="">No limit</option>
300 [% FOREACH search_languages_loo IN search_languages_loop %]
301 [% IF ( search_languages_loo.selected ) %]
302 <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]" selected="selected">[% search_languages_loo.language_description | html %]</option>
304 <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]">[% search_languages_loo.language_description | html %]</option>
308 <!-- /LANGUAGE LIMIT -->
310 </div> <!-- / #langfilter -->
311 </div> <!-- / .col -->
313 </div> <!-- / .row -->
315 [%# Following on one line for translatability %]
316 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
318 <div id="subtypes" class="row">
319 <!-- SUBTYPE LIMITS -->
320 <div class="col-sm-6 col-lg-3">
321 <div class="advsearch_limit">
323 <label for="subtype_audience">Audience</label>
324 <select id="subtype_audience" name="limit" class="subtype">
325 <option value="" selected="selected" class="menuheader">Any audience</option>
326 <option value="aud:a">Preschool</option>
327 <option value="aud:b">Primary</option>
328 <option value="aud:c">Pre-adolescent</option>
329 <option value="aud:d">Adolescent</option>
330 <option value="aud:e">Adult</option>
331 <option value="aud:f">Specialized</option>
332 <option value="aud:g">General</option>
333 <option value="aud:j">Juvenile</option>
336 </div> <!-- /.advsearch_limit -->
337 </div> <!-- / .col-sm-6 col-lg-3 -->
339 <div class="col-sm-6 col-lg-3">
340 <div class="advsearch_limit">
342 <label for="subtype_content">Content</label>
343 <select id="subtype_content" name="limit" class="subtype">
344 <option value="" selected="selected" class="menuheader">Any content</option>
345 <option value="fic:1">Fiction</option>
346 <option value="fic:0">Non-fiction</option>
347 <option value="bio:b">Biography</option>
348 <option value="mus:j">Musical recording</option>
349 <option value="mus:i">Non-musical recording</option>
352 </div> <!-- /.advsearch_limit -->
355 <div class="col-sm-6 col-lg-3">
356 <div class="advsearch_limit">
358 <label for="subtype_format">Format</label>
359 <select id="subtype_format" name="limit" class="subtype">
360 <option value="" selected="selected" class="menuheader">Any format</option>
361 <option value="l-format:ta">Regular print</option>
362 <option value="l-format:tb">Large print</option>
363 <option value="l-format:tc or l-format:fb">Braille</option>
364 <option value="">-----------</option>
365 <option value="l-format:sd">CD audio</option>
366 <option value="l-format:ss">Cassette recording</option>
367 <option value="l-format:vf">VHS tape / Videocassette</option>
368 <option value="l-format:vd">DVD video / Videodisc</option>
369 <option value="l-format:co">CD software</option>
370 <option value="l-format:cr">Website</option>
373 </div> <!-- /.advsearch_limit -->
374 </div> <!-- / .col-sm-6 col-lg-3 -->
376 <div class="col-sm-6 col-lg-3">
377 <div class="advsearch_limit">
379 <label for="subtype_additional">Additional content types for books/printed materials</label>
380 <select id="subtype_additional" name="limit" class="subtype">
381 <option value="">Any</option>
382 <option value="ctype:a">Abstracts/summaries</option>
383 <option value="ctype:b">Bibliographies</option>
384 <option value="ctype:c">Catalogs</option>
385 <option value="ctype:d">Dictionaries</option>
386 <option value="ctype:e">Encyclopedias </option>
387 <option value="ctype:f">Handbooks</option>
388 <option value="ctype:g">Legal articles</option>
389 <option value="ctype:i">Indexes</option>
390 <option value="ctype:j">Patent document</option>
391 <option value="ctype:k">Discographies</option>
392 <option value="ctype:l">Legislation</option>
393 <option value="ctype:m">Theses</option>
394 <option value="ctype:n">Surveys</option>
395 <option value="ctype:o">Reviews</option>
396 <option value="ctype:p">Programmed texts</option>
397 <option value="ctype:q">Filmographies</option>
398 <option value="ctype:r">Directories</option>
399 <option value="ctype:s">Statistics</option>
400 <option value="ctype:t">Technical reports</option>
401 <option value="ctype:v">Legal cases and case notes</option>
402 <option value="ctype:w">Law reports and digests</option>
403 <option value="ctype:z">Treaties </option>
406 </div> <!-- /.advsearch_limit -->
407 </div> <!-- / .col-sm-6 col-lg-3 -->
408 </div> <!-- / #subtypes.row -->
409 <!-- SUBTYPE LIMITS -->
410 [% END # / IF usmarc %]
413 <div id="subtypes_unimarc" class="row">
414 <!-- SUBTYPE LIMITS -->
415 [% INCLUDE 'subtypes_unimarc.inc' %]
418 [% END # / IF expanded_options %]
420 [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or ( OpacAdvSearchOptions and OpacAdvSearchOptions.size > 0 and not expanded_options ) %]
421 <div class="text-center">
422 <fieldset class="action">
423 <!-- SEARCH BUTTONS -->
424 [% PROCESS searchbuttons %]
425 <!-- /SEARCH BUTTONS -->
429 </div> <!-- / .container-fluid -->
430 </div> <!-- / .main -->
433 [% INCLUDE 'opac-bottom.inc' %]
434 [% BLOCK searchbuttons %]
436 <input class="btn btn-primary" type="submit" accesskey="s" name="do" title="Search" value="Search" />
438 [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 ) %]
439 [% IF expanded_options %]
440 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=0" class="btn btn-default more-less-options">Fewer options</a>
441 [% ELSIF not expanded_options %]
442 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=1" class="btn btn-default more-less-options">More options</a>
446 <a href="/cgi-bin/koha/opac-search.pl?do=Clear" class="btn btn-default new-search">New search</a>
450 [% BLOCK jsinclude %]
451 [% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %]
452 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
454 $(document).ready(function() {
455 [% IF search_groups %]
456 function branch_limit() {
457 if( $("#branchloop").val() != "" ){
458 $("#categoryloop").val("").prop('disabled',true);
460 $("#categoryloop").prop('disabled',false);
462 if ( $("#categoryloop").val() != "" ){
463 $("#branchloop").val("").prop('disabled',true);
465 $("#branchloop").prop('disabled',false);
469 $("#branchloop,#categoryloop").on("change",function(){
474 $('#advsearches').tabs();
475 jQuery.cookie.json = true;
477 $('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide();
479 [% IF ( ReturnToSearch ) %]
480 if (form_serialized = jQuery.cookie("form_serialized")) {
481 // Add missing term inputs if there were more than 3
482 var count = (form_serialized.match(/&q=/g) || []).length;
483 for(var i = 3 ; i < count ; i++) {
484 $("a.ButtonPlus:last").click();
486 $('#advsearch form').deserialize(form_serialized);
488 if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) {
489 $('#language-limit') .val(form_serialized_limits[0]);
490 $('#branchloop') .val(form_serialized_limits[1]);
491 $('#subtype_audience') .val(form_serialized_limits[2]);
492 $('#subtype_content') .val(form_serialized_limits[3]);
493 $('#subtype_format') .val(form_serialized_limits[4]);
494 $('#subtype_additional') .val(form_serialized_limits[5]);
495 $('#locloop') .val(form_serialized_limits[6]);
498 //Clear all form cookies
499 jQuery.removeCookie("form_serialized", { path: '/'});
500 jQuery.removeCookie("form_serialized_limits", { path: '/'});
501 jQuery.removeCookie("search_path_code", { path: '/'});
503 $('#advsearch form').submit(function() {
504 $('[name^="limit"]').each(function(){
505 if( $(this).val() == '' ){
506 $(this).prop("disabled","disabled");
509 $(".search-term-row").each(function(){
510 if( $(this).find('input[name="q"]').val() == "" ){
511 $(this).find('input[name="q"]').prop("disabled","disabled");
512 $(this).find('select[name="op"]').prop("disabled","disabled");
513 $(this).find('select[name="idx"]').prop("disabled","disabled");
516 form_serialized = $(this).serialize();
517 jQuery.cookie("form_serialized", form_serialized,{ path: '/'});
518 form_serialized_limits = [
519 $('#language-limit').val(), $('#branchloop').val(),
520 $('#subtype_audience').val(), $('#subtype_content').val(),
521 $('#subtype_format').val(), $('#subtype_additional').val(),
524 jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'});
525 [% IF ( expanded_options ) %]
526 jQuery.cookie("search_path_code", 'exs',{ path: '/'});
528 jQuery.cookie("search_path_code", 'ads',{ path: '/'});
533 /* This function allows to display a new field to search.
535 $(document).on("click", '.ButtonPlus', function(e) {
537 $('.ButtonLess').show();
538 var thisLine = $(this).parent().parent();
539 var newLine = thisLine.clone();
540 $(newLine).find('.search-term-input select[name="op"]').first().prop("disabled",false).show();
541 newLine.find('input').val('');
542 thisLine.after(newLine);
545 $(document).on("click", '.ButtonLess', function(e) {
547 if( $("a.ButtonLess").length <= 2 ) {
548 $('.ButtonLess').hide();
550 $(this).parent().parent().remove();
551 $('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide();