Skip to content

Comments

Wrap filter queries in parentheses to avoid query conflicts#567

Merged
codycooperross merged 1 commit intomasterfrom
filter-query-fix
Feb 12, 2026
Merged

Wrap filter queries in parentheses to avoid query conflicts#567
codycooperross merged 1 commit intomasterfrom
filter-query-fix

Conversation

@codycooperross
Copy link
Contributor

@codycooperross codycooperross commented Feb 11, 2026

Purpose

Filter queries are currently not wrapped in parentheses in the query= parameter. This can result in unexpected results due to the interaction between AND joins in buildQuery. This PR wraps filter queries in parentheses to avoid these unexpected results.

closes: Add github issue that originated this PR

Approach

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected operator precedence in search filters, ensuring complex expressions with AND/OR produce expected results.
    • Improved consistency and accuracy of advanced search when using custom filter strings.
    • Handled empty or missing filters more gracefully, avoiding unintended query behavior.
    • No changes to the search UI or how filters are entered; results are simply more reliable.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

Walkthrough

A small targeted fix to searchDoiQuery.ts that wraps the filterQuery segment in parentheses during query composition. This change modifies operator precedence when combining filters with AND clauses in the constructed query.

Changes

Cohort / File(s) Summary
Query Builder Fix
src/data/queries/searchDoiQuery.ts
Wrapped filterQuery in parentheses when building the query string to correct operator precedence in filter combinations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • bklaing2
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: wrapping filter queries in parentheses to resolve query precedence conflicts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch filter-query-fix

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cypress
Copy link

cypress bot commented Feb 11, 2026

akita    Run #1887

Run Properties:  status check passed Passed #1887  •  git commit 791a0e9458 ℹ️: Merge f3145282db4ba89e37321ca8ba58f3076a30cea7 into d8ab8d916b15ad2fdc72bbd65a66...
Project akita
Branch Review filter-query-fix
Run status status check passed Passed #1887
Run duration 01m 52s
Commit git commit 791a0e9458 ℹ️: Merge f3145282db4ba89e37321ca8ba58f3076a30cea7 into d8ab8d916b15ad2fdc72bbd65a66...
Committer codycooperross
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 47
View all changes introduced in this branch ↗︎

@codycooperross codycooperross merged commit 658ef41 into master Feb 12, 2026
13 checks passed
@codycooperross codycooperross deleted the filter-query-fix branch February 12, 2026 08:28
@cypress
Copy link

cypress bot commented Feb 12, 2026

akita    Run #1889

Run Properties:  status check passed Passed #1889  •  git commit 658ef4140a: Merge pull request #567 from datacite/filter-query-fix
Project akita
Branch Review master
Run status status check passed Passed #1889
Run duration 01m 56s
Commit git commit 658ef4140a: Merge pull request #567 from datacite/filter-query-fix
Committer codycooperross
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 47
View all changes introduced in this branch ↗︎

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.

2 participants