Improve pattern search exclusions and ranked overflow results - #1752
Open
ilganeli wants to merge 5 commits into
Open
Improve pattern search exclusions and ranked overflow results#1752ilganeli wants to merge 5 commits into
ilganeli wants to merge 5 commits into
Conversation
opcode81
reviewed
Aug 5, 2026
Comment on lines
585
to
+589
| :param paths_include_glob: optional glob (relative to project root, e.g. ``"src/**/*.ts"``) restricting which files are searched. | ||
| :param paths_exclude_glob: optional glob to exclude files; takes precedence over `paths_include_glob`. | ||
| :param paths_exclude_globs: additional optional globs to exclude files; additive with `paths_exclude_glob`. | ||
| :param paths_priority_globs: optional ordered globs that rank matching paths before unmatched paths. | ||
| The first matching glob determines a path's priority. |
Contributor
There was a problem hiding this comment.
Having both paths_exclude_glob and paths_exclude_globs is not reasonable.
To generalise the interface, we can use a list-based interface for both inclusions and exclusions.
The priority feature is a new addition, but it's unlikely to be useful in the vast majority of circumstances.
@MischaPanch what are you thoughts regarding the usefulness of the priority feature? Worth keeping?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In large repos with extensive documentation, serena had insufficiently flexible configuration for what to exclude as relevant and was crashing out, blowing up context.
Summary
paths_exclude_globswhile preserving the existing singular exclusion parameter; both forms combine additivelypaths_priority_globsfor deterministic live-path-first pattern searchesCompatibility and behavior
The existing
paths_exclude_globschema and behavior are unchanged. New list exclusions are optional and additive.Priority ranking is also opt-in. When supplied, matches are ordered by the first matching priority glob, normalized path, and matched line. When omitted, Serena preserves its existing source ordering.
Oversized ranked excerpts contain whole match entries and report how many matches and files were shown versus omitted. The implementation sizes the excerpt linearly and serializes only the full result and final excerpt.
Verification
uv run poe test -q -k 'search_for_pattern or TestSearchText or TestSearchFiles or TestGlobMatch'— 93 passed, 1 skippeduv run poe lint— passeduv run poe type-check— passedChecklist
CONTRIBUTING.mdregarding the scope of PRs.CHANGELOG.md, which concisely describes the change.