Skip to content

Fix advanced search refine/extend combination logic#361

Open
level09 wants to merge 2 commits into
mainfrom
fix/advanced-search-block-grouping
Open

Fix advanced search refine/extend combination logic#361
level09 wants to merge 2 commits into
mainfrom
fix/advanced-search-block-grouping

Conversation

@level09

@level09 level09 commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes BYNT-1760.

Multi-block advanced search (Refine/Extend) combined query blocks incorrectly in two ways:

  1. OR flattened block conditions. or_(*conditions, *next_conditions) OR-ed every individual condition instead of (block1) OR (block2). A block with "tag X AND access group G" degraded to "tag X OR access group G", inflating results.
  2. Chained blocks dropped earlier ones. The or branch read from the first block's condition list instead of the accumulated result, so with three or more blocks intermediate blocks were silently discarded.

Both bulletin and actor paths are fixed with a left-associative fold: each block's conditions are grouped with AND, then combined with the accumulated query using the block's op. Empty blocks are skipped.

Added focused tests compiling the generated SQL for grouping, chained ORs, and AND-after-OR.

Present since the search rewrite in #97, so this affects existing deployments, not just recent branches.

@level09 level09 requested a review from apodacaduron as a code owner July 11, 2026 12:00
@level09 level09 self-assigned this Jul 11, 2026
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: de8e4c47-c173-441c-8c04-9e99f78892b4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/advanced-search-block-grouping

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.

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.

1 participant