This enhancement will add a new box above the search results allowing one to search within the previous search results
Created attachment 115779 [details] [review] 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
I get the following error when I try to apply this to a sandbox: Applying: Bug 27546: Add 'Search within results' search box error: sha1 information is lacking or useless (catalogue/search.pl). error: could not build fake ancestor Patch failed at 0001 Bug 27546: Add 'Search within results' search box
(In reply to Sally from comment #2) > I get the following error when I try to apply this to a sandbox: > > Applying: Bug 27546: Add 'Search within results' search box > error: sha1 information is lacking or useless (catalogue/search.pl). > error: could not build fake ancestor > Patch failed at 0001 Bug 27546: Add 'Search within results' search box Apologies, there is a dependency, bug 22605
Created attachment 116533 [details] [review] 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>
This worked great.
error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt). error: could not build fake ancestor Patch failed at 0001 Bug 27546: Add 'Search within results' search box hint: Use 'git am --show-current-patch=diff' to see the failed patch Tried to QA, code looks good.
Created attachment 118958 [details] [review] 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>
(In reply to Victor Grousset/tuxayo from comment #6) > error: sha1 information is lacking or useless > (koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt). > error: could not build fake ancestor > Patch failed at 0001 Bug 27546: Add 'Search within results' search box > hint: Use 'git am --show-current-patch=diff' to see the failed patch > > Tried to QA, code looks good. Did you apply the dependency? It auto merged for me, attached a new patch
> Did you apply the dependency? Yes, followed git-bz suggestion. Thanks, it applies now :)
First test looks good :) Is that expected that "edit search" only edits the main part and not the merge with the "within" part?
(In reply to Victor Grousset/tuxayo from comment #10) > First test looks good :) > > Is that expected that "edit search" only edits the main part and not the > merge with the "within" part? I believe they show up under the 'limits' secion, nearer the bottom of the form/
> I believe they show up under the 'limits' secion, nearer the bottom of the > form/ Indeed! Thanks
When emptying the "Search within results" field and clicking on search, it still searches with the previous limit value. I guess that's an issue? When doing a search, then using the within two times: search "book" => within "guide" => within "rome" I have a final search like this: 2 result(s) found for 'kw,wrdl: book' with limit(s): 'guide rome'. That seems what should happen right? I though it would replace the first within but chaining them seems valid and better even :) (though I don't have the right PoV about how this should be used)
Wait, the first thing happens because of the second. i.e. chaining means that emptying the field will chain the empty string. Is that needed to easily "unrefine" the search? Like to fix a typo or something too specific. There is always the back button of the browser.
(In reply to Victor Grousset/tuxayo from comment #14) > Wait, the first thing happens because of the second. i.e. chaining means > that emptying the field will chain the empty string. > > Is that needed to easily "unrefine" the search? Like to fix a typo or > something too specific. There is always the back button of the browser. Leaving the 'Search within' blank and pressing search should not change anything - it will not clear previous refinements, that is done via 'Edit this search' Future enhancement could be to list the limits and allow for unchecking on the results page, but I do not think that is necessary for this stage
Created attachment 119025 [details] [review] 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>
ok, current behavior looks good for me. Code ok, QA script ok, it works. Will retest and pass QA when the dep (bug 22605) will be passed QA
Blocked by failed dependency
Created attachment 123817 [details] [review] 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>
Created attachment 131780 [details] [review] 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>
Retested, still good, passing QA :)
+ window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]&limit="+index+$("#refiner").val(); Arf we must URI-espace $("#refiner").val() no ?
(In reply to Fridolin Somers from comment #22) > + window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% > query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw > %]&limit="+index+$("#refiner").val(); > Arf we must URI-espace $("#refiner").val() no ? 100% needs an escape_str() there to prevent XSS. Great catch, Frido!
Created attachment 133873 [details] [review] Bug 27546: (follow-up) Escape new search string
Arf we have a problem with #idx in actual code : In koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc there is : <select class="advsearch" name="idx" id="idx"> But this include is used several times, so there are several id="idx". We should remove this id. So this patch should use select[name="idx"] I propose
Created attachment 134729 [details] [review] Bug 27546: (follow-up) Avoid index clash
Pushed to master for 22.11. Nice work everyone, thanks!
Enhancement will not be backported to 22.05.x series unless requested
Don't forget Needs dcocumenting :)