Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with combo index search parameter when using date #6566

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

epeartree
Copy link
Collaborator

@epeartree epeartree commented Dec 18, 2024

the problem:
Given a combo index search parameters configured with a date search parameter components, combo index searching is skipped when a date query parameter value is submitted to the search stack.

root cause:
The root cause of the problem is that we default DateRangeParam.myPrefix to 'EQUAL' when parsing a query date parameter into a DateRangeParam object. More specifically, query parameter birthdate=2021-01-01 and birthdate=eq2021-01-01 would yield the same DateRangeParam object with dateRangeParam.myPrefix=EQUAL making it impossible to differentiate whether the prefix was specifically provided or not. As a result, searching the single table populated by combo index search parameters to optimise specific searches is skipped since the dateRangeParam has a prefix. see SearchBuilder.validateParamValuesAreValidForComboParam

what was done:

  • Modified class DateRangeParam to not default the prefix to 'EQUAL' as doing so would make it impossible for indexes created by a combo search index parameters to be queried during searches;
  • added utility method and comment to return a prefix of 'equal' when performing computation based on prefix value;
  • modified tests;
  • added changelog;

…x. The purpose is to run the 'fix' through the pipelines to see what fails.
Copy link

github-actions bot commented Dec 18, 2024

Formatting check succeeded!

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.50%. Comparing base (406db33) to head (3baa480).
Report is 160 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6566      +/-   ##
============================================
- Coverage     83.54%   83.50%   -0.04%     
- Complexity    27432    28559    +1127     
============================================
  Files          1707     1797      +90     
  Lines        106185   111141    +4956     
  Branches      13397    13961     +564     
============================================
+ Hits          88710    92808    +4098     
- Misses        11750    12349     +599     
- Partials       5725     5984     +259     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@jmarchionatto jmarchionatto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good, but there is no test for the specific point of the fix, which is that the combo search is now considered. Please add test for that case.

@ParameterizedTest
@CsvSource(value = {
"2025-01-01, true",
"eq2025-01-01, false"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow the test. If those two query strings are considered equivalent, why are we treating them differently? I guess it's because we turn this into a date range, but that logic is kinda confusing. Recommend at least adding comments here to explain what's going on with this test and why we should expect a different result for these two values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP at all. to avoid a regression, this test and its purpose needs be crystal clear on the first read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Combo Index Search Parameter functionality does not work correctly with date query parameter values
3 participants