From ba451a7784ad4bc48ddc0b88bd4292ec3847984b Mon Sep 17 00:00:00 2001 From: Kathy Lussier Date: Wed, 1 Aug 2012 09:31:24 -0400 Subject: [PATCH] Add a new "starts with" search option to the advanced search page. Signed-off-by: Kathy Lussier Signed-off-by: Dan Scott --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 5 +++++ Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 cfe88532ff..d613a7e5db 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -44,6 +44,11 @@ sub _prepare_biblio_search_basics { } elsif ($contains eq 'exact') { $query =~ s/[\^\$]//g; $query = '^' . $query . '$'; + } 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; 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..ad0243a1ed 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'); -- 2.11.0