Bug 22924

Summary: Elasticsearch, SysPref FacetMaxCount don't show more than 10 facets
Product: Koha Reporter: axel Amghar <axel.amghar>
Component: Searching - ElasticsearchAssignee: axel Amghar <axel.amghar>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P5 - low CC: alex.arnaud, black23, bouzid.fergani, e.betemps, fridolin.somers, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14419
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 22903    
Attachments: Bug 22924: Elasticsearch, show more than 10 facets
Bug 22924: Elasticsearch, show more than 10 facets
Bug 22924: [alternate] Make elasticsearch honour FacetMaxCount system preference
Bug 22924: Make elasticsearch honour FacetMaxCount system preference
Bug 22924: Unit tests

Description axel Amghar 2019-05-16 11:21:02 UTC
When you use the SysPref FacetMaxCount with a value higher than 10 , we see more than 10 facets in refine your search, but with elastic we don't see more than 10 facets, Examples:

with zebra:
https://snag.gy/RY5cwP.jpg

with elastic:
https://snag.gy/v8bnBD.jpg
Comment 1 axel Amghar 2019-05-16 14:54:52 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2019-05-22 16:01:09 UTC Comment hidden (obsolete)
Comment 3 Michal Denar 2019-05-23 18:59:46 UTC Comment hidden (obsolete)
Comment 4 Bouzid Fergani 2019-05-24 19:31:59 UTC
Hi,
I have problem when applying this patch.
Without the patch, when i search "a", i have results but with this patch nothing.
Thanks.
Comment 5 Michal Denar 2019-05-24 20:09:47 UTC
Hi,
in kohadevbox? Did you aplly restart_all after patch?
Comment 6 Nick Clemens (kidclamp) 2019-06-05 20:26:02 UTC
Created attachment 90341 [details] [review]
Bug 22924: [alternate] Make elasticsearch honour FacetMaxCount system preference

We have a line in QueryBuilder to respect the preference if a facet is expanded, it seems
we forgot to pass the option to the querybuilder however

To test:
1 - Enable Elasticsearch
2 - Set FacetMaxCount to 20
3 - Search in ES for '*' or something with a lot of results
4 - Expand some facets, note you get no more than 10 for any facet
5 - Apply patch
6 - Search again
7 - Expand facets, note they now go up to 20
8 - Try with various values of FacetMaxCount
Comment 7 Nick Clemens (kidclamp) 2019-06-05 20:27:27 UTC
I propose an alternate patch - QueryBuilder should already respect the preference, as long as we pass an expanded facet

It should have unit tests regardless of which patch we use
Comment 8 Alex Arnaud 2019-06-17 12:06:05 UTC
Created attachment 90665 [details] [review]
Bug 22924: Make elasticsearch honour FacetMaxCount system preference

We have a line in QueryBuilder to respect the preference if a facet is expanded, it seems
we forgot to pass the option to the querybuilder however

To test:
1 - Enable Elasticsearch
2 - Set FacetMaxCount to 20
3 - Search in ES for '*' or something with a lot of results
4 - Expand some facets, note you get no more than 10 for any facet
5 - Apply patch
6 - Search again
7 - Expand facets, note they now go up to 20
8 - Try with various values of FacetMaxCount

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Comment 9 Nick Clemens (kidclamp) 2019-06-21 11:42:47 UTC
Created attachment 90903 [details] [review]
Bug 22924: Unit tests
Comment 10 Bouzid Fergani 2019-07-05 19:56:14 UTC
HI,
The patch of tests is not apply correctly.
Bug 22924 - Elasticsearch, SysPref FacetMaxCount don't show more than 10 facets

90665 - Bug 22924: Make elasticsearch honour FacetMaxCount system preference
90903 - Bug 22924: Unit tests

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 22924: Make elasticsearch honour FacetMaxCount system preference
Applying: Bug 22924: Unit tests
Using index info to reconstruct a base tree...
M	t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
Falling back to patching base and 3-way merge...
Auto-merging t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
CONFLICT (content): Merge conflict in t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
error: Failed to merge in the changes.
Patch failed at 0001 Bug 22924: Unit tests
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-22924-Unit-tests-N6uhfY.patch

Bouzid
Comment 11 Michal Denar 2019-07-05 19:58:58 UTC
Can anybody rebase on master?

Thank you.
Comment 12 Nick Clemens (kidclamp) 2019-07-05 20:25:37 UTC
Bug 14419 adds the size parameter to all facets. Expanded facet is removed so this one is no longer needed

*** This bug has been marked as a duplicate of bug 14419 ***