Skip to content

Commit

Permalink
[#43343111] Add title phrase and barcode search options
Browse files Browse the repository at this point in the history
Add Title Phrase to both staff and OPAC advanced search;
add Barcode to staff advanced search.
  • Loading branch information
jwt01 authored and ctfliblime committed Feb 15, 2013
1 parent 69f4ced commit dbc9a5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ $(document).ready(function() {
KOHA.collapsed_searchfields = $("<select name='idx'>\
<option value='text'>Keyword</option>\
<option value='title'>Title</option>\
<option value='title-nostem'>Title Phrase</option>\
<option value='subject'>Subject</option>\
<option value='author'>Author</option>\
<option value='publisher'>Publisher</option>\
<option value='barcode'>Barcode</option>\
<option value='isbn'>ISBN</option>\
</select>");
KOHA.expanded_searchfields = $("<select name='idx'>\
Expand Down
1 change: 1 addition & 0 deletions koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ $("document").ready(function(){
KOHA.collapsed_searchfields = $("<select name='idx'>\
<option value='text'>Keyword</option>\
<option value='title'>Title</option>\
<option value='title-nostem'>Title Phrase</option>\
<option value='subject'>Subject</option>\
<option value='author'>Author</option>\
<option value='publisher'>Publisher</option>\
Expand Down
5 changes: 5 additions & 0 deletions lib/Koha/Solr/Query.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ sub _build_query_from_cgi{

while ( my ($q, $idx, $op) = $params->() ) {
next unless $q;
$q =~ s/^\s+|\s+$//g;

$query .= sprintf ' %s ', uc($op)
if $query;
Expand All @@ -132,6 +133,10 @@ sub _build_query_from_cgi{
$q =~ s/\s+/?/g;
$q .= '*';
}
elsif ($idx ~~ ['title-nostem', 'author-exact']) {
$q = qq{"$q"};
}

elsif( $q !~ /"/ && $q !~ /\(|\)/ && $q =~ /\S+\s+\S+/ ) {
# Add grouping for this field if not quoted and multiple terms.
$q = "($q)";
Expand Down

0 comments on commit dbc9a5a

Please sign in to comment.