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)
| 759 | /// stop words (common English + programming terms) that match too many |
| 760 | /// nodes to be useful for ranking. |
| 761 | pub fn tokenize_for_fts(text: &str) -> Vec<String> { |
| 762 | text.split(|c: char| !c.is_alphanumeric() && c != '_') |
| 763 | .filter(|w| w.len() >= 3) |
| 764 | .map(|w| w.to_lowercase()) |
| 765 | .filter(|w| !FTS_STOP_WORDS.contains(&w.as_str())) |
| 766 | .collect() |
| 767 | } |
| 768 | |
| 769 | /// Encode an embedding key as "path\0chunk_idx". |
| 770 | #[inline] |