Bug 34021 - Add option to search within results in the OPAC
Summary: Add option to search within results in the OPAC
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-15 11:26 UTC by Hugo Agud
Modified: 2024-01-26 14:32 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 34021: Add 'search within' to OPAC (2.13 KB, patch)
2023-07-20 00:43 UTC, David Cook
Details | Diff | Splinter Review
Bug 34021: Add 'search within' to OPAC (2.17 KB, patch)
2023-07-20 15:32 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 34021: wrap search within using block with an ID for styling (2.18 KB, patch)
2023-09-19 03:14 UTC, David Cook
Details | Diff | Splinter Review
Bug 34021: Add 'search within' to OPAC (2.23 KB, patch)
2023-10-31 15:19 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34021: wrap search within using block with an ID for styling (2.24 KB, patch)
2023-10-31 15:19 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34021: Make search within OPAC consistent with staff interface (2.02 KB, patch)
2023-11-01 05:43 UTC, David Cook
Details | Diff | Splinter Review
Bug 34021: Add 'search within' to OPAC (2.29 KB, patch)
2023-11-06 23:21 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 34021: wrap search within using block with an ID for styling (2.29 KB, patch)
2023-11-06 23:21 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 34021: Make search within OPAC consistent with staff interface (2.08 KB, patch)
2023-11-06 23:21 UTC, Lucas Gass
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Agud 2023-06-15 11:26:42 UTC
related: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27546

In 22.11 has been added the option of searching within results of a search, it should  be nice to add also to opac.

Or even it could be improved with the chance of search within subcollections..

It should be great if a search could be filtered by default via itypetype, ccode or anyother value in item or perhaps and biblio and koha keeps the filter in all searches of a user does.

For example: if a library have a special collection of old books, and a user starts a search limiting by collection, let the filter on and being able to search within results

now a facet filter od ccode limitation is lost when launch a search

BR
Comment 1 David Cook 2023-07-20 00:43:48 UTC
Created attachment 153693 [details] [review]
Bug 34021: Add 'search within' to OPAC

This change adds a "Search within results" box to the OPAC, which
complements the feature already in the staff interface.

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "e" in the search box and click the search button
3. Click the "Books" value for the "Item types" facet, and
note there are fewer search results
4. Type "test" into the "Search within results" box and click
the Search button next to the box
5. Note that now there are only 2 results.
6. Also note that the "Books" facet is still selected
Comment 2 Sam Lau 2023-07-20 15:32:39 UTC
Created attachment 153729 [details] [review]
Bug 34021: Add 'search within' to OPAC

This change adds a "Search within results" box to the OPAC, which
complements the feature already in the staff interface.

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "e" in the search box and click the search button
3. Click the "Books" value for the "Item types" facet, and
note there are fewer search results
4. Type "test" into the "Search within results" box and click
the Search button next to the box
5. Note that now there are only 2 results.
6. Also note that the "Books" facet is still selected

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Lucas Gass 2023-09-18 17:00:36 UTC
Hey David,

I imagine some libraries will want to hide this altogether. Could we possibily wrap it label/input in a HTML element w/ a class or ID? That would make it easy to do so.
Comment 4 David Cook 2023-09-19 03:14:59 UTC
Created attachment 155872 [details] [review]
Bug 34021: wrap search within using block with an ID for styling
Comment 5 David Cook 2023-09-19 03:15:29 UTC
(In reply to Lucas Gass from comment #3)
> Hey David,
> 
> I imagine some libraries will want to hide this altogether. Could we
> possibily wrap it label/input in a HTML element w/ a class or ID? That would
> make it easy to do so.

Sure thing.

Popped this back to Signed Off as it was a simple change.
Comment 6 Katrin Fischer 2023-10-31 15:19:48 UTC
Created attachment 158137 [details] [review]
Bug 34021: Add 'search within' to OPAC

This change adds a "Search within results" box to the OPAC, which
complements the feature already in the staff interface.

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "e" in the search box and click the search button
3. Click the "Books" value for the "Item types" facet, and
note there are fewer search results
4. Type "test" into the "Search within results" box and click
the Search button next to the box
5. Note that now there are only 2 results.
6. Also note that the "Books" facet is still selected

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2023-10-31 15:19:51 UTC
Created attachment 158138 [details] [review]
Bug 34021: wrap search within using block with an ID for styling

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 David Cook 2023-11-01 05:28:42 UTC
I hate failing my own stuff, but I noticed a problem.

If you do a search like this one:
http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=an%3A104&weight_search=1

You can try to "Search within results" using "Alcestis" but it won't work.

The reason is that this URL is the one that is constructed:
http://localhost:8080/cgi-bin/koha/opac-search.pl?q=ccl%3Dan%3A104&idx=kw&q=Alcestis&sort_by=relevance&addto=Add+to...

The an:104 has a ccl= prefix which causes the rest of the query string to be ignored. 

So either Search.pm needs a change or this change needs to be changed. 

--

It looks like a fix could be to follow the code from bug 27546 and instead of adding a "idx=kw and q=X" just add a "limit=X". At a glance, that looks like it would work.
Comment 9 David Cook 2023-11-01 05:39:39 UTC
(In reply to David Cook from comment #8)
> It looks like a fix could be to follow the code from bug 27546 and instead
> of adding a "idx=kw and q=X" just add a "limit=X". At a glance, that looks
> like it would work.

Technically, that will yield a worse version of "search within" than I had in some ways, but it would make it consistent with the staff interface version.

In order to get limit to work like "idx=kw and q=X", we'd need to add "kw,wrdl,rtrn:" in front of "X" which would need some Javascript.
Comment 10 David Cook 2023-11-01 05:43:07 UTC
Created attachment 158166 [details] [review]
Bug 34021: Make search within OPAC consistent with staff interface

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "an:104" in the search box and click the search button
3. Type "Alcestis" into the "Search within results" box and
click the Search button next to the box
4. Note that now there are only 2 results
5. Type "Dale" into the "Search within results" box and
click the Search button next to the box
6. Note that you're taken directly to the last result
Comment 11 Lucas Gass 2023-11-06 23:21:48 UTC
Created attachment 158579 [details] [review]
Bug 34021: Add 'search within' to OPAC

This change adds a "Search within results" box to the OPAC, which
complements the feature already in the staff interface.

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "e" in the search box and click the search button
3. Click the "Books" value for the "Item types" facet, and
note there are fewer search results
4. Type "test" into the "Search within results" box and click
the Search button next to the box
5. Note that now there are only 2 results.
6. Also note that the "Books" facet is still selected

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 12 Lucas Gass 2023-11-06 23:21:50 UTC
Created attachment 158580 [details] [review]
Bug 34021: wrap search within using block with an ID for styling

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 13 Lucas Gass 2023-11-06 23:21:52 UTC
Created attachment 158581 [details] [review]
Bug 34021: Make search within OPAC consistent with staff interface

Test plan:

0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
2. Type "an:104" in the search box and click the search button
3. Type "Alcestis" into the "Search within results" box and
click the Search button next to the box
4. Note that now there are only 2 results
5. Type "Dale" into the "Search within results" box and
click the Search button next to the box
6. Note that you're taken directly to the last result

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 14 Kyle M Hall 2024-01-26 14:32:27 UTC
The new limit does not show up in the search results description. It does in the staff search.