Tokenize text for the FTS inverted index. Extracts lowercase alphanumeric words of length >= 3, filtering out stop words (common English + programming terms) that match too many nodes to be useful for ranking.
(text: &str)
| 771 | /// stop words (common English + programming terms) that match too many |
| 772 | /// nodes to be useful for ranking. |
| 773 | pub fn tokenize_for_fts(text: &str) -> Vec<String> { |
| 774 | text.split(|c: char| !c.is_alphanumeric() && c != '_') |
| 775 | .filter(|w| w.len() >= 3) |
| 776 | .map(|w| w.to_lowercase()) |
| 777 | .filter(|w| !FTS_STOP_WORDS.contains(&w.as_str())) |
| 778 | .collect() |
| 779 | } |
| 780 | |
| 781 | /// Encode an embedding key as "path\0chunk_idx". |
| 782 | #[inline] |