Bugzilla – Attachment 119025 Details for
Bug 27546
Add option to search within results on the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27546: Add 'Search within results' search box
Bug-27546-Add-Search-within-results-search-box.patch (text/plain), 5.02 KB, created by
Victor Grousset/tuxayo
on 2021-03-30 20:55:55 UTC
(
hide
)
Description:
Bug 27546: Add 'Search within results' search box
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2021-03-30 20:55:55 UTC
Size:
5.02 KB
patch
obsolete
>From 6dc93d945756b8cd14f0c10295752fda0eefad03 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 21 Jan 2021 14:23:35 +0000 >Subject: [PATCH] Bug 27546: Add 'Search within results' search box > >This enhancement adds a new input above the search results allowing one to search within the results. The search >box will take a query and add it as a limit to the previous search > >These patches make a slight change to the search header, passing the dropdown selection as a parameter rather thandirectly. > >Searching this way is functionally equivaled to adding 'AND' with the new term to original results. > >To test: >1 - Apply patch >2 - Search on staff client wiht a term that returns results >3 - Note the new 'Search within results box' >4 - Add a search term >5 - Note new results and confirm they are as expected >6 - Enable IntranetCatalogSearchPulldown and confirm the dropdown works as expected >7 - Edit your search - the reinfements appear in the limits section and can be removed > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > catalogue/search.pl | 2 +- > .../prog/en/includes/cat-search.inc | 2 +- > .../prog/en/modules/catalogue/results.tt | 17 +++++++++++++++++ > 3 files changed, 19 insertions(+), 2 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 110bbbd07a..6a0259e9da 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -366,7 +366,7 @@ if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) { > my $idx = "ms_".$indexes[0]; > $idx =~ s/\,/comma/g; # template toolkit doesn't like variables with a , in it > $idx =~ s/-/dash/g; # template toolkit doesn't like variables with a dash in it >- $template->param($idx => 1); >+ $template->param(header_pulldown => $idx); > } > > # an operand can be a single term, a phrase, or a complete ccl query >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >index cdafcfe01f..c548cc63e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc >@@ -28,7 +28,7 @@ > <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="cat-search-block"> > [% IF ( Koha.Preference('IntranetCatalogSearchPulldown') ) %] > <label class="tip" for="search-form">Enter search keywords:</label> >- [% INCLUDE 'search_indexes.inc' %] >+ [% INCLUDE 'search_indexes.inc' $header_pulldown = 1 %] > [% ELSE %] > <label class="tip" for="search-form">Enter search keywords:</label> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index e7d6bc20e7..29d010b728 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -66,6 +66,16 @@ > [% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc %] with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %]. > </h3> > <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]">Edit this search</a> >+ <div id="search_within_results"> >+ <form id="refine_search"> >+ <label for="limit">Search within results</label> >+ [% IF ( Koha.Preference('IntranetCatalogSearchPulldown') ) %] >+ [% INCLUDE 'search_indexes.inc' ms_kw = 1 %] >+ [% END %] >+ <input name="limit" id="refiner" type="text" title="Search results"> >+ <input type="submit" id="refine" value="Search"> >+ </form> >+ </div> > > <div class="searchheader" id="searchheader"> > <div id="selection_ops"> >@@ -769,6 +779,13 @@ > first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]", > last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]", > } >+ >+ $("#refine_search").on('submit',function(e){ >+ e.preventDefault(); >+ var index = $("#refine_search #idx").val() || ""; >+ if( index){index += ":";} >+ window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]&limit="+index+$("#refiner").val(); >+ }); > </script> > [% Asset.js("js/pages/results.js") | $raw %] > [% END %] >-- >2.31.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27546
:
115779
|
116533
|
118958
|
119025
|
123817
|
131780
|
133873
|
134729