From: Kathy Lussier Date: Wed, 1 Aug 2012 13:31:24 +0000 (-0400) Subject: Add a new "starts with" search option to the advanced search page. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fkmlussier%2F1031775;p=working%2FEvergreen.git Add a new "starts with" search option to the advanced search page. Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 5d40319716..94be90fc72 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -44,8 +44,13 @@ sub _prepare_biblio_search_basics { } elsif ($contains eq 'exact') { $query =~ s/[\^\$]//g; $query = '^' . $query . '$'; - } - $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0; + } elsif ($contains eq 'starts') { + $query =~ s/"//g; + $query =~ s/[\^\$]//g; + $query = '^' . $query; + $query = ('"' . $query . '"') if index $query, ' '; + } + $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0; # Hack for journal title - completed! if ($q eq 'jtitle') { diff --git a/Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 b/Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 index 3647fe7f54..1b71d3437f 100644 --- a/Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 +++ b/Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 @@ -3,7 +3,8 @@ {value => 'contains', label => l('Contains')}, {value => 'nocontains', label => l('Does not contain')}, {value => 'phrase', label => l('Contains phrase')}, - {value => 'exact', label => l('Matches exactly')} + {value => 'exact', label => l('Matches exactly')}, + {value => 'starts', label => l('Starts with')} ]; contains = CGI.param('contains'); queries = CGI.param('query');