Bug 14419

Summary: Expanding facets (Show more) performs a new search
Product: Koha Reporter: Nick Clemens <nick>
Component: SearchingAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: normal    
Priority: P5 - low CC: arm, axel.amghar, e.betemps, fridolin.somers, jonathan.druart, josef.moravec, lucas, marjorie.barry-vila, mathsabypro
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22903
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22924
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Bug Depends on:    
Bug Blocks: 25701    
Attachments: Bug 14419 - Expanding facets (Show more) performs a new search
Bug 14419 - Expanding facets (Show more) performs a new search
Bug 14419: Expanding facets (Show more) performs a new search
Bug 14419: Expanding facets (Show more) performs a new search
Bug 14419: Expanding facets (Show more) performs a new search
Bug 14419: (QA follow-up) Restore the link styling
Bug 14419: [19.05.x] (squashed) Expanding facets (Show more) performs a new search

Description Nick Clemens 2015-06-18 22:05:11 UTC
Currently when loading facets for a page facets are calculated for the set number of records but only 5 are pushed to the html.  Click the "Show more" link on any facet group requires performing the whole search again.

If I am right, the heavy work is pulling facets from the records, so I say, why not push all the facets to the page and make them collapsible to save space?
Comment 1 Nick Clemens 2015-06-18 22:10:35 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2015-06-19 09:36:14 UTC
Nick,
That's a good idea.

Todo:
1/ "Show more" is no longer a link
2/ If expanded, the link should not be "show more" :)
3/ Should be done at the intranet too
Comment 3 Nick Clemens 2015-06-19 20:12:49 UTC
Created attachment 40425 [details] [review]
Bug 14419 - Expanding facets (Show more) performs a new search

This patch removes the constraint of only passing 5 facets to the template unless the list is expanded, in fact, it removes the 'expanded' attribute from Search.pm
Now that all facets are passed to page it adds a 'show more' link at the bottom of lists and allows user to expand or collapse any facet set without reloading page.

Updated tests included.

Whitespace patches still needed.

To test:
1  - Perform an OPAC search that returns more than 5 of any given facet type
2  - Click the "Show more" link on the facets and see that the search is reloaded
3  - Apply patch
4  - Repeat search
5  - Note that you can click "Show more" without reloading page
6  - Test that page load is not greatly affected
7  - Ensure that all facet links function normally
8  - Ensure that facets are the same a prior to patch
9  - Repeat for staff client
10 - Prove t/Search.t

NOTE: This patch makes it much easier to see that there is an existing issue with marking the "active" facet.  Ending punctuation seems to confuse the matcher, I'll fix it if I figure it out, but I didn't cause it.
Comment 4 Nicole C. Engard 2015-09-03 14:21:35 UTC
After I apply this patch I can't click 'Show More' at all.
Comment 5 Nick Clemens 2016-04-28 17:29:41 UTC
*** Bug 11326 has been marked as a duplicate of this bug. ***
Comment 6 Agnes Rivers-Moore 2016-07-19 20:32:30 UTC
Possibly related to this? We find in some searches the "Show more" does not appear at all when there should be more than 5 facets. Cannot see a pattern to when the "Show more" is missing. (Koha ver 3.22)
Comment 7 Agnes Rivers-Moore 2016-07-19 21:02:44 UTC
See possibly related Bug 16821. 'Show more' may be missing if loading facets is restricted to only first page of results
Comment 8 Fridolin Somers 2019-06-17 14:23:43 UTC
Is this the same as Bug 22903 ?
Comment 9 Nick Clemens 2019-07-02 12:58:56 UTC
Created attachment 91185 [details] [review]
Bug 14419: Expanding facets (Show more) performs a new search

This patch removes the constraint of only passing 5 facets to the template unless the list is expanded, in fact, it removes the 'expanded' attribute from Search.pm
Now that all facets are passed to page it adds a 'show more' link at the bottom of lists and allows user to expand or collapse any facet set without reloading page.

Updated tests included.

To test:
1  - Perform an OPAC search that returns more than 5 of any given facet type
2  - Click the "Show more" link on the facets and see that the search is reloaded
3  - Apply patch
4  - Repeat search
5  - Note that you can click "Show more" without reloading page
6  - Test that page load is not greatly affected
7  - Ensure that all facet links function normally
8  - Ensure that facets are the same a prior to patch
9  - Repeat for staff client
10 - Prove t/Search.t

NOTE: This patch makes it much easier to see that there is an existing issue with marking the "active" facet.  Ending punctuation seems to confuse the matcher.
Comment 10 Nick Clemens 2019-07-02 13:00:01 UTC
(In reply to Fridolin SOMERS from comment #8)
> Is this the same as Bug 22903 ?

Yes, it does seem to be. Also this supersedes the need for 22924
We will need to decide which one we want.
Comment 11 Michal Denar 2019-07-03 19:30:25 UTC
Created attachment 91234 [details] [review]
Bug 14419: Expanding facets (Show more) performs a new search

This patch removes the constraint of only passing 5 facets to the template unless the list is expanded, in fact, it removes the 'expanded' attribute from Search.pm
Now that all facets are passed to page it adds a 'show more' link at the bottom of lists and allows user to expand or collapse any facet set without reloading page.

Updated tests included.

To test:
1  - Perform an OPAC search that returns more than 5 of any given facet type
2  - Click the "Show more" link on the facets and see that the search is reloaded
3  - Apply patch
4  - Repeat search
5  - Note that you can click "Show more" without reloading page
6  - Test that page load is not greatly affected
7  - Ensure that all facet links function normally
8  - Ensure that facets are the same a prior to patch
9  - Repeat for staff client
10 - Prove t/Search.t

NOTE: This patch makes it much easier to see that there is an existing issue with marking the "active" facet.  Ending punctuation seems to confuse the matcher.

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 12 Josef Moravec 2019-07-03 21:01:35 UTC
Created attachment 91241 [details] [review]
Bug 14419: Expanding facets (Show more) performs a new search

This patch removes the constraint of only passing 5 facets to the template unless the list is expanded, in fact, it removes the 'expanded' attribute from Search.pm
Now that all facets are passed to page it adds a 'show more' link at the bottom of lists and allows user to expand or collapse any facet set without reloading page.

Updated tests included.

To test:
1  - Perform an OPAC search that returns more than 5 of any given facet type
2  - Click the "Show more" link on the facets and see that the search is reloaded
3  - Apply patch
4  - Repeat search
5  - Note that you can click "Show more" without reloading page
6  - Test that page load is not greatly affected
7  - Ensure that all facet links function normally
8  - Ensure that facets are the same a prior to patch
9  - Repeat for staff client
10 - Prove t/Search.t

NOTE: This patch makes it much easier to see that there is an existing issue with marking the "active" facet.  Ending punctuation seems to confuse the matcher.

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 13 Josef Moravec 2019-07-03 21:01:40 UTC
Created attachment 91242 [details] [review]
Bug 14419: (QA follow-up) Restore the link styling

Test plan:
Look at Show more/less links in facets, in opac and staff client
--> without this patch they are pure text, no styling, no hand cursor
--> with this patch it is link, but continues to work as before

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 14 Martin Renvoize 2019-07-04 08:26:29 UTC
Nice work!

Pushed to master for 19.11.00
Comment 15 Nick Clemens 2019-07-05 20:25:37 UTC
*** Bug 22924 has been marked as a duplicate of this bug. ***
Comment 16 Nick Clemens 2019-07-05 20:26:24 UTC
*** Bug 22903 has been marked as a duplicate of this bug. ***
Comment 17 Fridolin Somers 2019-07-25 13:21:14 UTC
This is a rather big patch, and is more an enhancement.
I'll wait a bit to see if bugs are found before considering backport.
Comment 18 Nick Clemens 2019-12-17 01:31:32 UTC
Created attachment 96355 [details] [review]
Bug 14419: [19.05.x] (squashed) Expanding facets (Show more) performs a new search

This patch removes the constraint of only passing 5 facets to the template unless the list is expanded, in fact, it removes the 'expanded' attribute from Search.pm
Now that all facets are passed to page it adds a 'show more' link at the bottom of lists and allows user to expand or collapse any facet set without reloading page.

Updated tests included.

To test:
1  - Perform an OPAC search that returns more than 5 of any given facet type
2  - Click the "Show more" link on the facets and see that the search is reloaded
3  - Apply patch
4  - Repeat search
5  - Note that you can click "Show more" without reloading page
6  - Test that page load is not greatly affected
7  - Ensure that all facet links function normally
8  - Ensure that facets are the same a prior to patch
9  - Repeat for staff client
10 - Prove t/Search.t

NOTE: This patch makes it much easier to see that there is an existing issue with marking the "active" facet.  Ending punctuation seems to confuse the matcher.

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Bug 14419: (QA follow-up) Restore the link styling

Test plan:
Look at Show more/less links in facets, in opac and staff client
--> without this patch they are pure text, no styling, no hand cursor
--> with this patch it is link, but continues to work as before

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 19 Lucas Gass 2020-01-10 20:51:43 UTC
backported the 19.05.x patchset for 19.05.07