neosqlite.collection.text_search module¶
Enhanced text search functionality for NeoSQLite with international character support.
- class neosqlite.collection.text_search.TextSearchOptimizer[source]¶
Bases:
objectOptimize text search operations with caching and Unicode support.
This class provides optimized text search functionality with: - LRU caching for compiled regex patterns - Unicode normalization for international character support - Diacritic-insensitive matching - Case-insensitive searching
- static compile_pattern(search_term: str)[source]¶
Compile and cache regex patterns for better performance.
- Parameters:
search_term – The term to search for
- Returns:
Compiled regex pattern or None if compilation fails
- neosqlite.collection.text_search.unified_text_search(document: dict[str, Any], search_term: str) bool[source]¶
Unified text search function that works with both simple queries and aggregation pipelines.
This function provides enhanced text search capabilities with: - Case-insensitive matching - Unicode support for international characters - Diacritic-insensitive matching (e.g., ‘cafe’ matches ‘café’) - Support for nested documents and arrays - Proper handling of special characters
- Parameters:
document – The document to search in
search_term – The term to search for
- Returns:
True if the document contains the search term, False otherwise
- neosqlite.collection.text_search.simple_text_contains(text: str, search_term: str) bool[source]¶
Simple case-insensitive text containment check.
This is a fast fallback for basic ASCII text matching.
- Parameters:
text – The text to search in
search_term – The term to search for
- Returns:
True if the text contains the search term, False otherwise