% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/index.R
\name{create_index}
\alias{create_index}
\title{Create a hash index on a .vtr file column}
\usage{
create_index(path, column, ci = FALSE)
}
\arguments{
\item{path}{Path to a \code{.vtr} file.}

\item{column}{Character vector. Name(s) of column(s) to index.}

\item{ci}{Logical. Build a case-insensitive index? Default \code{FALSE}.}
}
\value{
Invisible \code{NULL}. The index is written as a \code{.vtri} sidecar file.
}
\description{
Builds a persistent hash index stored as a \code{.vtri} sidecar file alongside
the \code{.vtr} file. The index maps key hashes to row group indices, enabling
O(1) row group identification for equality predicates (\code{filter(col == value)}).
}
\details{
For composite indexes on multiple columns, pass a character vector.
Composite indexes accelerate AND-combined equality predicates
(e.g., \code{filter(col1 == "a", col2 == "b")}).

The index is automatically loaded by \code{\link[=tbl]{tbl()}} when present. It composes with
zone-map pruning and binary search on sorted columns.
}
\examples{
f <- tempfile(fileext = ".vtr")
write_vtr(data.frame(id = letters, val = 1:26, stringsAsFactors = FALSE), f)
create_index(f, "id")
tbl(f) |> filter(id == "m") |> collect()
unlink(c(f, paste0(f, ".id.vtri")))

}
