An embedded engine for Rust and Python whose database is a bucket. Every process reads the index straight from storage and ranks exact, prefix, infix, abbreviation and misspelt matches together, in a fraction of a millisecond. No cluster, no server.
Hacker News titles, typed as prefixes
on 8 threads, Hacker News titles
for 40 million MusicBrainz recordings
comparisons with tantivy, Typesense and Meilisearch
Measured on one laptop; see Benchmarks for every table and caveat.
One request collects every match kind and ranks them with popularity, match kind and text length. You never choose between prefix, infix or fuzzy search. Results from the demo index:
dancDancing Queen – ABBAprefixrhcpUnder the Bridge – Red Hot Chili Peppersabbreviationbohemain rapsodyBohemian Rhapsody – QueenfuzzydancingqueenDancing Queen – ABBAprefixqueenBohemian Rhapsody – Queeninfixis this the realBohemian Rhapsody – Queensynonymcompletype is a library, not a service. Storage is the only shared component.
If-None-Match, so
concurrent writers never corrupt each other.Tenants, locales, listeners, promotions and takedowns are small indexes stacked on the shared catalogue, overriding it per document id, without a copy. Five layers over 200,000 titles answer in 0.2 ms at the median.
catalogshared, built oncecatalog-delocal chartsradioedits and removalsuser-…own playstakedownsBohemian Rhapsody (Remastered 2011) – Queen radio
Dancing Queen – ABBA catalog
Dancing Queen (Live Session) – ABBA radio
import completype
db = completype.connect("s3://my-bucket/completions")
txn = db.begin()
txn.append("songs", docs)
txn.commit()
engine = db.engine() # follows new versions
engine.complete("danc", ["songs"])
let database = Database::open("./data", Vec::<(String, String)>::new()).await?;
let mut txn = database.begin().await?;
txn.append_documents("songs", docs, [])?;
txn.commit().await?;
let engine = Arc::new(Engine::new());
let replica = Arc::new(Replica::new(database, IndexOptions::default()));
replica.sync(&engine).await?;
let _follower = replica.follow(&engine, Duration::from_secs(5));
engine.complete(&["songs"], "danc", 10)?;
There is no completype server. The engine is a library in your process, and the database is a set of files in a bucket or directory. Your application is deployed however you like; completype adds no service to it.
Those are search servers for documents with many fields, filters and facets, and every query crosses the network. completype does autocompletion only, inside your process. Many applications use both: a search server for the results page, completype for the box.
Through the store. Each commit creates the next manifest create-only, so exactly one writer wins each version and the others retry. For high write rates, a single ingestor elected by an expiring lease commits queued change sets in order.
Engines sync every sync_every seconds (5 by default), so a committed transaction appears
within a few seconds; engine.sync() loads it at once.