Bug 26537 - Search does not work when no term in value_builder/unimarc_field_4XX.pl
Summary: Search does not work when no term in value_builder/unimarc_field_4XX.pl
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Alex Arnaud
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-25 13:15 UTC by Fridolin Somers
Modified: 2023-01-23 11:01 UTC (History)
4 users (show)

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


Attachments
Bug 26537: Fix search when no term in value_builder/unimarc_field_4XX.pl (2.05 KB, patch)
2020-09-25 13:22 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.18 KB, patch)
2020-10-01 15:12 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.18 KB, patch)
2021-12-30 16:15 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.18 KB, patch)
2021-12-30 16:20 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.18 KB, patch)
2021-12-30 16:23 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.18 KB, patch)
2021-12-30 16:25 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: (follow-up) fix paging of results (2.18 KB, patch)
2021-12-30 16:27 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537 : (follow-up) fix paging of results (961 bytes, patch)
2021-12-31 08:12 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537 : (follow-up) fix paging of results (961 bytes, patch)
2021-12-31 08:16 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537 : (follow-up) fix paging of results (1.89 KB, patch)
2022-01-19 13:40 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.23 KB, patch)
2022-01-20 12:13 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26537: (follow-up) fix paging of results (1.93 KB, patch)
2022-01-20 12:13 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query (2.21 KB, patch)
2022-12-28 09:46 UTC, Thibaud Guillot
Details | Diff | Splinter Review
Bug 26537: (follow-up) fix paging of results (2.04 KB, patch)
2022-12-28 09:46 UTC, Thibaud Guillot
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2020-09-25 13:15:04 UTC
Cataloguing plugin value_builder/unimarc_field_4XX.pl has an itemtype filter.
It does not work when used without a search term.
Comment 1 Fridolin Somers 2020-09-25 13:22:25 UTC
Created attachment 110756 [details] [review]
Bug 26537: Fix search when no term in value_builder/unimarc_field_4XX.pl

Cataloguing plugin value_builder/unimarc_field_4XX.pl has an itemtype filter.
It does not work when used without a search term.

Test plan :
1) Be sure search on itemtype return some results
2) Use cataloguing plugin unimarc_field_4XX.pl
3) Enter no search term and select an itemtype
4) Check you get correct results
5) Enter a search term and dont select an itemtype
6) Check you get correct results
7) Enter a search term and select an itemtype
8) Check you get correct results
Comment 2 Alex Arnaud 2020-10-01 15:05:38 UTC
@frido:

7) and 8) don't works

Searching a term + item type raises a software error.
Comment 3 Alex Arnaud 2020-10-01 15:09:06 UTC
When searching term and item type, the ES query looks like this:

"query":"(:jean and itemtype:LIVR)"

My opinion is that we should use QueryBuilder to make the query. Counter patch is coming.
Comment 4 Alex Arnaud 2020-10-01 15:12:09 UTC
Created attachment 111049 [details] [review]
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query
Comment 5 Alex Arnaud 2020-10-01 15:12:40 UTC
@frido, can you test the last patch ?
Comment 6 Fridolin Somers 2020-10-02 13:13:46 UTC
Maybe rename $es_query into $search_query, it's not specific to ES
Comment 7 Fridolin Somers 2021-03-01 09:18:19 UTC
-            $to = $from + $resultsperpage ;
+            $to = $startfrom * $resultsperpage + $resultsperpage ;
I dont understand this change.
Comment 8 Owen Leonard 2021-04-15 14:55:36 UTC
(In reply to Fridolin Somers from comment #7)
> -            $to = $from + $resultsperpage ;
> +            $to = $startfrom * $resultsperpage + $resultsperpage ;
> I dont understand this change.

This patch breaks paging of results.
Comment 9 Thibaud Guillot 2021-12-30 16:15:17 UTC Comment hidden (obsolete)
Comment 10 Thibaud Guillot 2021-12-30 16:20:08 UTC Comment hidden (obsolete)
Comment 11 Thibaud Guillot 2021-12-30 16:23:43 UTC Comment hidden (obsolete)
Comment 12 Thibaud Guillot 2021-12-30 16:25:59 UTC Comment hidden (obsolete)
Comment 13 Thibaud Guillot 2021-12-30 16:27:45 UTC Comment hidden (obsolete)
Comment 14 Thibaud Guillot 2021-12-31 08:12:58 UTC Comment hidden (obsolete)
Comment 15 Thibaud Guillot 2021-12-31 08:16:04 UTC
Created attachment 128938 [details] [review]
Bug 26537 : (follow-up) fix paging of results
Comment 16 Thibaud Guillot 2022-01-19 13:40:50 UTC
Created attachment 129607 [details] [review]
Bug 26537 : (follow-up) fix paging of results

Also I renamed "es_query" variable for better understanding (this script
works with Elastic search but also Zebra)
Comment 17 Owen Leonard 2022-01-20 12:13:53 UTC
Created attachment 129646 [details] [review]
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 18 Owen Leonard 2022-01-20 12:13:57 UTC
Created attachment 129647 [details] [review]
Bug 26537: (follow-up) fix paging of results

Also I renamed "es_query" variable for better understanding (this
script works with Elastic search but also Zebra)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 19 Fridolin Somers 2022-01-27 22:18:12 UTC
We should also create a bug report for value builder marc21_linking_section.pl no ?
Comment 20 Fridolin Somers 2022-01-27 22:47:28 UTC
In fact also does not work because of lowercase boolean, see Bug 25616
Comment 21 Katrin Fischer 2022-03-27 00:10:36 UTC
The patch doesn't apply, I believe the fix is probably simple but don't want to mess with it:

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query
Using index info to reconstruct a base tree...
M	cataloguing/value_builder/unimarc_field_4XX.pl
Falling back to patching base and 3-way merge...
Auto-merging cataloguing/value_builder/unimarc_field_4XX.pl
CONFLICT (content): Merge conflict in cataloguing/value_builder/unimarc_field_4XX.pl
error: Failed to merge in the changes.
Patch failed at 0001 Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query
hint: Use 'git am --show-current-patch=diff' to see the failed 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-26537-use-QueryBuilder-in-unimarcfield4XX-plug-sBlXav.patch
Comment 22 Thibaud Guillot 2022-12-28 09:46:08 UTC
Created attachment 144858 [details] [review]
Bug 26537: use QueryBuilder in unimarc_field_4XX plugin to make query

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Rebased on master: Thibaud Guillot <thibaud.guillot@biblibre.com>
Comment 23 Thibaud Guillot 2022-12-28 09:46:13 UTC
Created attachment 144859 [details] [review]
Bug 26537: (follow-up) fix paging of results

Also I renamed "es_query" variable for better understanding (this
script works with Elastic search but also Zebra)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 24 Amaury GAU 2023-01-23 11:01:10 UTC
Test plan :
0) Use ES
1) Add a new record
2) Use cataloguing plugin unimarc_field_4XX.pl
3) Enter no search term and select an itemtype
4) Expect internal server error  
5) Apply patch 
6) retry
7) Expected no error but there was 

Did we do well testing this way and can this be added to the patch ?