1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Trigram Index for LIKE/ILIKE acceleration.
//!
//! This module implements a trigram-based inverted index using Roaring Bitmaps
//! for efficient pattern matching queries (LIKE '%pattern%').
//!
//! # Architecture (SOTA 2026)
//!
//! Based on arXiv:2310.11703v2 and `PostgreSQL` `pg_trgm`:
//! - Extract trigrams from text with padding
//! - Store inverted index: trigram → `RoaringBitmap` of doc IDs
//! - Query: intersect bitmaps for all query trigrams
//! - Scoring: Jaccard similarity for ranking
//!
//! # Multi-Architecture SIMD Support
//!
//! | Architecture | Instruction Set | Trigrams/cycle |
//! |--------------|-----------------|----------------|
//! | x86_64 | AVX-512 | ~21 |
//! | x86_64 | AVX2 | ~10 |
//! | aarch64 | NEON | ~5 |
//! | Fallback | Scalar | ~3 |
//!
//! # Performance Targets
//!
//! | Volume | Without Index | With Trigram | Speedup |
//! |--------|---------------|--------------|---------|
//! | 10K | 45ms | < 5ms | > 9x |
//! | 100K | 450ms | < 20ms | > 22x |
//! | 1M | 4.5s | < 100ms | > 45x |
// Includes architecture/ISA identifiers in markdown tables.
pub use TrigramComputeBackend;
pub use ;
pub use ;
pub use ConcurrentTrigramIndex;