//! Similarity index for near-duplicate detection using MinHash + LSH.
//!
//! This module provides O(1) expected-time duplicate detection for assertions:
//!
//! 1. **Bloom Filter**: Fast probabilistic check ("definitely not seen" or "maybe seen")
//! 2. **MinHash**: Compact signature for estimating Jaccard similarity
//! 3. **LSH (Locality-Sensitive Hashing)**: Efficient candidate retrieval
//!
//! # Usage
//!
//! ```ignore
//! use stemedb_storage::{HybridStore, GenericSimilarityIndex, SimilarityIndex};
//!
//! let store = HybridStore::open("./data")?;
//! let index = GenericSimilarityIndex::with_defaults(Arc::new(store));
//!
//! // On startup, rebuild Bloom filter from persisted data
//! index.rebuild_bloom_filter().await?;
//!
//! // Check for duplicates before ingesting
//! let result = index.check_similarity("Tesla", "has_revenue").await?;
//! if result.is_duplicate {
//!     println!("Near-duplicate found with similarity {}", result.max_similarity);
//! }
//!
//! // Add new content to the index
//! let hash = index.add("Tesla", "has_revenue", timestamp).await?;
//! ```
//!
//! # Algorithm Parameters
//!
//! - **MinHash k=128**: 95% confidence at 0.9 Jaccard threshold
//! - **Shingle size=3**: Character 3-grams (language-agnostic)
//! - **LSH bands=16, rows=8**: 99.96% recall at s=0.9, good separation at s=0.8
//! - **Bloom filter**: 1M items, 1% FPR (~1.2MB memory)
//!
//! # Storage Layout
//!
//! - MinHash signatures: `\x00MH:{content_hash_hex}`
//! - LSH buckets: `\x00LSH:{band:02}:{bucket_hash_hex}`

mod model;
mod store_impl;
mod traits;

pub use model::{
    LshBucket, MinHashSignature, SimilarityCheckResult, SimilarityIndexConfig,
    DEFAULT_BLOOM_EXPECTED_ITEMS, DEFAULT_BLOOM_FP_RATE, DEFAULT_LSH_BANDS,
    DEFAULT_LSH_ROWS_PER_BAND, DEFAULT_MINHASH_K, DEFAULT_SHINGLE_SIZE,
};
pub use store_impl::GenericSimilarityIndex;
pub use traits::SimilarityIndex;
