Bug 30626 - DT REST API wrapper not building the filter query correctly
Summary: DT REST API wrapper not building the filter query correctly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 30643 (view as bug list)
Depends on: 24561
Blocks: 30576
  Show dependency treegraph
 
Reported: 2022-04-27 10:32 UTC by Jonathan Druart
Modified: 2023-06-08 22:26 UTC (History)
4 users (show)

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


Attachments
Bug 30626: DT REST API wrapper - Fix general search (1.58 KB, patch)
2022-04-27 10:34 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30626: Fix test (1.13 KB, patch)
2022-04-27 10:35 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 30626: DT REST API wrapper - Fix general search (1.65 KB, patch)
2022-04-27 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30626: Fix test (1.19 KB, patch)
2022-04-27 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30626: (QA follow-up) Fix test plan (920 bytes, patch)
2022-04-27 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30626: DT REST API wrapper - Fix general search (1.70 KB, patch)
2022-04-28 10:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 30626: Fix test (1.24 KB, patch)
2022-04-28 10:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 30626: (QA follow-up) Fix test plan (976 bytes, patch)
2022-04-28 10:05 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 30626: Don't generate the query if no term passed (1.17 KB, patch)
2022-04-28 13:01 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-04-27 10:32:06 UTC
The general search query is not built correctly.

Say you have a table with column filters, like the main patron search:
General filter: henry
Specific filter on the 'Name' column: h

The generated query will be (= are actually LIKE):
{ Column1="henry" AND Column3="henry", ...} AND { Column2="h" }

The first term does not contain the Column2 attribute.
Comment 1 Jonathan Druart 2022-04-27 10:34:58 UTC
Created attachment 134016 [details] [review]
Bug 30626: DT REST API wrapper - Fix general search

The general search query is not built correctly.

Say you have a table with column filters, like the main patron search:
General filter: henry
Specific filter on the 'Name' column: h

The generated query will be (= are actually LIKE):
{ Column1="henry" AND Column3="henry", ...} AND { Column2="h" }

The first term does not contain the Column2 attribute.
Comment 2 Jonathan Druart 2022-04-27 10:35:02 UTC
Created attachment 134017 [details] [review]
Bug 30626: Fix test
Comment 3 Jonathan Druart 2022-04-27 10:36:11 UTC
We will certainly want to backport this fix. Skip the changes to the selenium tests if it does not apply.
Comment 4 Martin Renvoize 2022-04-27 10:55:50 UTC
Created attachment 134055 [details] [review]
Bug 30626: DT REST API wrapper - Fix general search

The general search query is not built correctly.

Say you have a table with column filters, like the main patron search:
General filter: henry
Specific filter on the 'Name' column: h

The generated query will be (= are actually LIKE):
{ Column1="henry" AND Column3="henry", ...} AND { Column2="h" }

The first term does not contain the Column2 attribute.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2022-04-27 10:55:54 UTC
Created attachment 134056 [details] [review]
Bug 30626: Fix test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2022-04-27 10:55:58 UTC
Created attachment 134057 [details] [review]
Bug 30626: (QA follow-up) Fix test plan
Comment 7 Martin Renvoize 2022-04-27 10:57:34 UTC
All works well for me in testing (I tried both with the unit test and manually testing with relevant data).

I can't entirely remember/work out why we had that line in there in the first place the way we did though.. :(.

Signing off
Comment 8 Jonathan Druart 2022-04-27 11:40:39 UTC
(In reply to Martin Renvoize from comment #6)
> Created attachment 134057 [details] [review] [review]
> Bug 30626: (QA follow-up) Fix test plan

We won't need that on top of bug 30576.
Comment 9 Katrin Fischer 2022-04-27 17:36:09 UTC
Could you provide a test plan for this one?
Comment 10 Jonathan Druart 2022-04-28 07:23:37 UTC
(In reply to Katrin Fischer from comment #9)
> Could you provide a test plan for this one?

Go to /cgi-bin/koha/members/members-home.pl
Click search without providing any terms
Search "henry" in the global DT search and "h" in the "Name" column filter
Comment 11 Nick Clemens 2022-04-28 10:05:08 UTC
Created attachment 134214 [details] [review]
Bug 30626: DT REST API wrapper - Fix general search

The general search query is not built correctly.

Say you have a table with column filters, like the main patron search:
General filter: henry
Specific filter on the 'Name' column: h

The generated query will be (= are actually LIKE):
{ Column1="henry" AND Column3="henry", ...} AND { Column2="h" }

The first term does not contain the Column2 attribute.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Nick Clemens 2022-04-28 10:05:12 UTC
Created attachment 134215 [details] [review]
Bug 30626: Fix test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 13 Nick Clemens 2022-04-28 10:05:17 UTC
Created attachment 134216 [details] [review]
Bug 30626: (QA follow-up) Fix test plan

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 14 Katrin Fischer 2022-04-28 11:36:16 UTC
Now Nick beat me to it :) Nick++
Comment 15 Jonathan Druart 2022-04-28 13:01:03 UTC
Created attachment 134252 [details] [review]
Bug 30626: Don't generate the query if no term passed
Comment 16 Jonathan Druart 2022-04-28 13:02:23 UTC
*** Bug 30643 has been marked as a duplicate of this bug. ***
Comment 17 Fridolin Somers 2022-04-28 20:51:00 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 18 Kyle M Hall 2022-05-06 17:51:08 UTC
Does not apply to 21.11.x, please rebase if needed.