Skip to content

Feat/cs/cleanup search#139

Merged
ReagentX merged 3 commits intodevelopfrom
feat/cs/cleanup-search
Mar 10, 2026
Merged

Feat/cs/cleanup search#139
ReagentX merged 3 commits intodevelopfrom
feat/cs/cleanup-search

Conversation

@ReagentX
Copy link
Owner

No description provided.

@ReagentX ReagentX self-assigned this Mar 10, 2026
@ReagentX ReagentX added enhancement New feature or request filtering Problems with regex search labels Mar 10, 2026
@ReagentX ReagentX requested a review from Copilot March 10, 2026 07:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a search/highlight handler cleanup by extracting shared pattern-matching logic between RegexHandler and HighlightHandler into a new SearchState struct, and fixes two separate bugs: a bitwise-OR-instead-of-logical-OR bug in reader.rs, and a misnamed constructor Counter::mean() that should be Counter::mode().

Changes:

  • Introduces SearchState in a new search.rs module to eliminate duplicated regex matching, match processing, and cleanup logic shared by RegexHandler and HighlightHandler
  • Renames Counter::mean() to Counter::mode() (and updates its call site) to correctly reflect the statistical operation being performed
  • Fixes a bug in reader.rs where bitwise OR (|) was used instead of logical OR (||) in a boolean condition

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/communication/handlers/search.rs New file introducing SearchState with shared search logic
src/communication/handlers/regex.rs Refactored to compose SearchState instead of duplicating logic
src/communication/handlers/highlight.rs Refactored to compose SearchState instead of duplicating logic
src/communication/handlers/mod.rs Registers the new search module
src/communication/reader.rs Fixes | (bitwise OR) to || (logical OR) in a boolean condition
src/util/aggregators/counter.rs Renames mean() to mode() to accurately describe the constructor
src/extensions/parser.rs Updates call site to use Counter::mode()

The one issue found is an unused import in the new file:

The handler::Handler trait is imported in search.rs line 5 but is never used in that file — only update_progress and UserInputHandler from that same use statement are needed. This will produce an unused import compiler warning in Rust.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ReagentX ReagentX merged commit 33aa0b9 into develop Mar 10, 2026
5 of 6 checks passed
@ReagentX ReagentX deleted the feat/cs/cleanup-search branch March 10, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request filtering Problems with regex search

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants