feat: add exclude_paths parameter to search#156
Open
filhocf wants to merge 1 commit into
Open
Conversation
Adds an exclude_paths parameter (list of GLOB patterns) to filter out unwanted files from search results. This is useful for projects with i18n/locales or generated files that dominate search results. The parameter is supported across all layers: - MCP tool (server.py) - CLI (--exclude flag) - Client library - Daemon - Query engine (SQL-level NOT GLOB filtering) When exclude_paths is provided, the query falls back to full-scan mode (same as paths), applying NOT GLOB clauses in the WHERE condition. Closes cocoindex-io#146
Author
|
@gemini-code-assist review |
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.
Summary
Adds an
exclude_pathsparameter to the search function, allowing users to exclude files matching GLOB patterns from search results.Problem
As described in #146, projects with
i18n/localesfolders or generated files see those files dominating search results because they contain concentrated keywords. Users need a way to exclude specific paths without removing them from the index entirely.Solution
Added
exclude_paths: list[str] | Noneparameter across all layers:protocol.pySearchRequestquery.pyNOT GLOBclauses in_full_scan_queryproject.pydaemon.pyclient.pyserver.pycli.py--excludeflagUsage
MCP tool:
{"query": "authentication", "exclude_paths": ["i18n/locales/*", "*.min.js"]}CLI:
Implementation
When
exclude_pathsis provided, the query engine falls back to full-scan mode (same behavior aspaths), applyingNOT GLOBclauses in the SQL WHERE condition. This ensures excluded files are filtered at the database level.Closes #146