SecurityFilter#
- class scikitplot.corpus.SecurityFilter(expression, label='security')[source]#
A scope bound to an index and AND-ed with every query’s own filter.
- Parameters:
- expressionFilter
The documents a caller of this index may see.
- labelstr, optional
Name for reports. Default
"security".
- Parameters:
Notes
User. Bind it where the index is built (
RetrievalIndex(..., security_filter=...)), not per query: a query’sfilteris AND-ed with it, so a caller (an MCP tool, an agent’s tool call) can narrow the result but never widen it, and there is no argument through which to drop it.Developer. The expression is replaced by
validate_filter’s copy at construction: the nine built-in operators, JSON scalars only, filterable fields only. A misspelled field is refused here instead of reading as missing (which would make a deny-list scopeNot(Eq(...))admit everything), and nothing reachable from the stored expression can be mutated by whoever built it.Examples
>>> scope = SecurityFilter(Eq("collection_id", "public")) >>> scope.combine(Eq("language", "en")) And(clauses=(Eq(field='collection_id', value='public'), Eq(field='language', value='en')))