pub struct SearchFilter {
pub languages: Option<Vec<Language>>,
pub chunk_types: Option<Vec<ChunkType>>,
pub path_pattern: Option<String>,
pub name_boost: f32,
pub query_text: String,
pub enable_rrf: bool,
pub note_weight: f32,
pub note_only: bool,
}Expand description
Filter and scoring options for search. Filter and scoring options for search.
Fields are public for direct construction via struct literals.
Builder methods (SearchFilter::new(), SearchFilter::with_query())
are provided as convenience helpers for common patterns — both styles
are supported and equivalent.
All fields are optional. Unset filters match all chunks.
Use SearchFilter::validate() to check constraints before searching.
Fields§
§languages: Option<Vec<Language>>Filter by programming language(s)
chunk_types: Option<Vec<ChunkType>>Filter by chunk type(s) (function, method, class, struct, enum, trait, interface, constant)
path_pattern: Option<String>Filter by file path glob pattern (e.g., src/**/*.rs)
name_boost: f32Weight for name matching in hybrid search (0.0-1.0)
0.0 = pure embedding similarity (default) 1.0 = pure name matching 0.2 = recommended for balanced results
query_text: StringQuery text for name matching (required if name_boost > 0 or enable_rrf)
enable_rrf: boolEnable RRF (Reciprocal Rank Fusion) hybrid search
When enabled, combines semantic search results with FTS5 keyword search using the formula: score = Σ 1/(k + rank), where k=60. This typically improves recall for identifier-heavy queries.
note_weight: f32Weight multiplier for note scores in unified search (0.0-1.0)
1.0 = notes scored equally with code (default) 0.5 = notes scored at half weight 0.0 = notes excluded from results
note_only: boolWhen true, return only notes (skip code search entirely)
Implementations§
Source§impl SearchFilter
impl SearchFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new SearchFilter with default values.
Use struct literal syntax to customize:
let filter = SearchFilter {
languages: Some(vec![Language::Rust]),
path_pattern: Some("src/**/*.rs".to_string()),
query_text: "retry logic".to_string(),
..SearchFilter::new()
};Sourcepub fn with_query(self, query: impl Into<String>) -> Self
pub fn with_query(self, query: impl Into<String>) -> Self
Set the query text (required for name_boost > 0 or enable_rrf).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SearchFilter
impl RefUnwindSafe for SearchFilter
impl Send for SearchFilter
impl Sync for SearchFilter
impl Unpin for SearchFilter
impl UnwindSafe for SearchFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more