# infino
[](https://crates.io/crates/infino)
[](https://docs.rs/infino)
[](https://github.com/infino-ai/infino/actions/workflows/ci.yml)
[](https://github.com/infino-ai/infino/blob/main/LICENSE)
**infino is a fast retrieval engine that runs SQL, full-text (BM25), and vector
search over a single copy of your data on object storage.** Data stays in Parquet
on S3 (or Azure, or local disk) and you query it at scale — embedded in your
process, with no separate search server or vector database to run.
- **Speed per dollar** — object-storage economics at search-engine speeds; on a
1-million-document index, warm BM25 queries return in the microsecond range.
- **Multi-modal queries** — keyword (BM25), vector, and SQL over the same rows.
- **Object-storage-native** — snapshot-isolated reads and atomic commits over S3,
Azure, or local disk.
- **Open format, no lock-in** — spec-compliant Parquet, so anything that reads
Parquet can read your data.
## Install
```sh
cargo add infino
```
infino installs the [mimalloc](https://github.com/microsoft/mimalloc) global
allocator by default. If you embed infino in a process that already sets a global
allocator, turn it off to avoid a second one:
`infino = { version = "0.1", default-features = false }`.
## Quickstart
```rust
use std::sync::Arc;
use arrow_array::{FixedSizeListArray, Float32Array, LargeStringArray, RecordBatch};
use arrow_schema::{DataType, Field, Schema};
use infino::{connect, BoolMode, IndexSpec, Metric, VectorFilter, VectorSearchOptions};
// Tiny stand-in for your embedding model so this runs as-is — a 16-dim
// one-hot by topic. Real embeddings are dense and higher-dimensional.
fn embed(topic: usize) -> Vec<f32> {
let mut v = vec![0.0_f32; 16];
v[topic] = 1.0;
v
}
# fn main() -> Result<(), Box<dyn std::error::Error>> {
// A knowledge base your agent retrieves over. "memory://" is in-process;
// use "./data" or "s3://bucket/prefix" to persist.
let db = connect("memory://")?;
let item = Arc::new(Field::new("item", DataType::Float32, true));
let schema = Arc::new(Schema::new(vec![
Field::new("source", DataType::LargeUtf8, false),
Field::new("body", DataType::LargeUtf8, false),
Field::new("embedding", DataType::FixedSizeList(item.clone(), 16), false),
]));
let docs = db.create_table(
"docs",
schema.clone(),
IndexSpec::new().fts("body").vector("embedding", 16, 1, Metric::Cosine),
)?;
let flat: Vec<f32> = [0usize, 0, 1].iter().flat_map(|&t| embed(t)).collect();
docs.append(&RecordBatch::try_new(
schema,
vec![
Arc::new(LargeStringArray::from(vec!["help-center", "help-center", "blog"])),
Arc::new(LargeStringArray::from(vec![
"To cancel a subscription, open Settings then Billing.",
"Refunds return to the original payment method.",
"Enable dark mode under Settings then Appearance.",
])),
Arc::new(FixedSizeListArray::new(item, 16, Arc::new(Float32Array::from(flat)), None)),
],
)?)?;
// Retrieve context to ground the agent's next answer:
let keyword = docs.bm25_search("body", "cancel subscription", 5, BoolMode::Or, None)?;
let semantic = docs.vector_search("embedding", &embed(0), 5, VectorSearchOptions::new(), None, None)?;
// vector kNN, restricted to rows whose body matches a keyword (pushdown filter):
let filtered = docs.vector_search(
"embedding", &embed(0), 5, VectorSearchOptions::new(),
Some(VectorFilter { column: "body", query: "billing", mode: BoolMode::Or }), None,
)?;
let billing = db.query_sql("SELECT body FROM docs WHERE source = 'help-center'")?;
assert_eq!(keyword.iter().map(|b| b.num_rows()).sum::<usize>(), 1); // BM25
assert_eq!(billing.iter().map(|b| b.num_rows()).sum::<usize>(), 2); // SQL filter
# Ok(())
# }
```
## API overview
The public surface is a small connection-and-table API:
- `connect` / `connect_with` open a `Connection`.
- `Connection` — `create_table`, `open_table`, `drop_table`, `list_tables`, `query_sql`.
- `Supertable` (the table handle) — `append`, `update`, `delete`, `schema`, and the
search methods `bm25_search`, `vector_search`, `token_match`, and `exact_match`
(each returns Arrow rows as `Vec<RecordBatch>`).
- Supporting types — `IndexSpec`, `Metric`, `BoolMode`, `VectorSearchOptions`,
`ConnectOptions`, `MutationStats`, and the `InfinoError` enum.
## Other languages
infino also ships **Python** (`pip install infino`) and **Node.js**
(`npm install @infino-ai/infino`) bindings. For multi-language guides and
examples, see the [project repository](https://github.com/infino-ai/infino).