rust_docs_mcp/search/config.rs
1//! # Search Configuration Module
2//!
3//! Provides configuration constants for search indexing and querying.
4//!
5//! These constants control resource usage and performance characteristics
6//! of the search functionality.
7
8/// Default buffer size for the Tantivy index writer (50MB)
9pub const DEFAULT_BUFFER_SIZE: usize = 50_000_000;
10
11/// Maximum buffer size for the Tantivy index writer (200MB)
12pub const MAX_BUFFER_SIZE: usize = 200_000_000;
13
14/// Maximum number of items to index per crate
15pub const MAX_ITEMS_PER_CRATE: usize = 100_000;
16
17/// Default limit for search results
18pub const DEFAULT_SEARCH_LIMIT: usize = 50;
19
20/// Maximum allowed limit for search results
21pub const MAX_SEARCH_LIMIT: usize = 1000;
22
23/// Maximum allowed query length in characters
24pub const MAX_QUERY_LENGTH: usize = 1000;
25
26/// Default fuzzy distance for typo tolerance
27pub const DEFAULT_FUZZY_DISTANCE: u8 = 1;
28
29/// Maximum fuzzy distance allowed
30pub const MAX_FUZZY_DISTANCE: u8 = 2;
31
32/// Whether transpositions cost 1 edit instead of 2 in fuzzy matching
33/// This makes fuzzy search more forgiving for common typos like "teh" -> "the"
34pub const FUZZY_TRANSPOSE_COST_ONE: bool = true;