feat(search): support multiple folders in the semantic-search path filter
Extend the ADR-027 Phase 2 path filter from a single path_prefix to a list of folders. The new normalize_path_prefixes() helper is the single source of truth for trimming, dropping blanks, and de-duplicating, and folds the legacy single path_prefix into the list for backward compatibility. build_base_filter_conditions() adds one MatchText to the must clause for a single folder (unchanged shape) and OR-s multiple folders via a nested Filter(should=[...]) so a file under any selected folder matches while still AND-ing against the ACL/doc_type/date conditions. path_prefixes is threaded through every search surface: the nc_semantic_search MCP tool, the visualization API (JSON body), and the viz route (CSV query param). The Astrolabe frontend folder picker that produces these lists ships in a companion astrolabe PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b91af923d2
commit
de6c4b360d
@@ -300,6 +300,7 @@ class SearchAlgorithm(ABC):
|
||||
modified_after: int | None = None,
|
||||
modified_before: int | None = None,
|
||||
path_prefix: str | None = None,
|
||||
path_prefixes: list[str] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> list[SearchResult]:
|
||||
"""Execute search with the given parameters.
|
||||
@@ -321,10 +322,13 @@ class SearchAlgorithm(ABC):
|
||||
``accessible_owners`` (ADR-027). ``None`` ⇒ open-ended.
|
||||
modified_before: Optional inclusive upper bound on ``modified_at``
|
||||
(Unix seconds, UTC). ``None`` ⇒ open-ended.
|
||||
path_prefix: Optional folder/path filter on the ``file_path`` payload
|
||||
field (ADR-027 Phase 2). Only ``doc_type == "file"`` points carry
|
||||
``file_path``, so a non-empty value implicitly restricts results
|
||||
to files. ``None`` ⇒ no path filter.
|
||||
path_prefix: Deprecated single folder/path filter; folded into
|
||||
``path_prefixes``. Kept for backward compatibility.
|
||||
path_prefixes: Optional folder/path filters on the ``file_path``
|
||||
payload field (ADR-027 Phase 2), OR-ed together. Only
|
||||
``doc_type == "file"`` points carry ``file_path``, so any
|
||||
non-empty value implicitly restricts results to files. ``None``
|
||||
or empty ⇒ no path filter.
|
||||
**kwargs: Algorithm-specific parameters
|
||||
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user