Bug 29302 - The dataTables Koha RESTful API wrapper should allow picking match type at the column level
Summary: The dataTables Koha RESTful API wrapper should allow picking match type at th...
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on: 29408
Blocks: 29422
  Show dependency treegraph
 
Reported: 2021-10-21 16:59 UTC by Martin Renvoize
Modified: 2022-07-14 09:14 UTC (History)
2 users (show)

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


Attachments
Bug 29302: Allow passing of 'criteria' at the column level (1.95 KB, patch)
2021-10-21 17:02 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29302: Allow passing of 'criteria' at the column level (4.28 KB, patch)
2021-11-05 11:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29302: Allow passing of 'criteria' at the column level (5.39 KB, patch)
2022-07-14 09:14 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2021-10-21 16:59:12 UTC
Whilst trying to understand how the `criteria` functionality of the datatables wrapper works, I discovered that is only works at the options level (i.e all searchable fields have the same match criteria applied).

We should be able to set the match criteria at the column level, for example you may want 'exact' match for fields that contain AV codes, or 'starts_with' one field and 'contains' for another.
Comment 1 Martin Renvoize 2021-10-21 17:02:26 UTC
Created attachment 126673 [details] [review]
Bug 29302: Allow passing of 'criteria' at the column level

This patch adds the option to pass 'criteria' at the 'column' definition
level which means you can set 'contains', 'starts_with', 'ends_with' and
'exact' match types for each different column.
Comment 2 Martin Renvoize 2021-10-21 17:03:31 UTC
I ended up needing something a bit more than this in my own bug (I want 'before' and 'after' date support).. but I wanted to post the basics here as a starting point.
Comment 3 Martin Renvoize 2021-11-05 08:15:37 UTC
I'm tempted to rename the key too.. 'criteria' isn't hugely clear and it took me reading the code to figure out.

Perhaps 'comparator or 'comparison_operator' would more clearly reflect its function?
Comment 4 Martin Renvoize 2021-11-05 11:18:30 UTC
Created attachment 127358 [details] [review]
Bug 29302: Allow passing of 'criteria' at the column level

This patch adds the option to pass 'criteria' at the 'column' definition
level which means you can set 'contains', 'starts_with', 'ends_with' and
'exact' match types for each different column.
Comment 5 Martin Renvoize 2022-02-17 15:51:58 UTC
This is a little naive in its approach.

Whilst I still think it would be useful to be able to specify the match type per column, I think we need to distinguish between 'search' and 'filter' operations.

When executing a 'search', it makes sense to perform 'contains', 'starts_with' type searches.. but for a 'filter' (i.e. at the individual column level) you might have a select like and want to do an 'exact' type match.  As such, I think we need to be able to specify more granularly still.
Comment 6 Martin Renvoize 2022-07-14 09:14:53 UTC
Created attachment 137695 [details] [review]
Bug 29302: Allow passing of 'criteria' at the column level

This patch adds the option to pass 'criteria' at the 'column' definition
level which means you can set 'contains', 'starts_with', 'ends_with' and
'exact' match types for each different column.