LexisMinhash::LSHIndex
Inherits Reference < Object
In-memory LSH index using Int32 doc IDs and linear probing storage LSHIndex is an in-memory locality-sensitive hashing index. It stores signatures per document and a set of per-band hash tables (LinearBucketTable) to quickly retrieve candidate document ids for a query.
Constructors
Initialize with expected number of documents for capacity planning
Table capacity is ~2x expected docs per band for good load factor
Initialize index with bands and expected_docs for capacity planning.
When store_signatures is false, signature storage is disabled to reduce memory usage,
but query_with_scores() will raise NotImplementedError.
Instance methods
Compute signature for text and insert into all band tables
Add a document using a precomputed signature
Add a document using TF-IDF style weights
Find all similar document pairs above threshold similarity
Retrieve stored signature by doc id (returns nil if not present or storage disabled)
Query and return candidates with similarity scores, sorted desc
Query by signature and return scored results
Query with weights (TF-IDF)
Alias for query_by_signature - weights are not needed at query time since the signature already contains the weighted information