From 998948bef64d64de248b232e1b8a4e16c3e6c644 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 --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 9 +++++++-- Open-ILS/src/templates/opac/parts/advanced/global_row.tt2 | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) 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'); -- 2.11.0