aarondb/index/art

Types

pub type Art {
  Art(root: Node)
}

Constructors

A functional Adaptive Radix Tree (ART) node. Uses path compression to minimize depth for sparse keys.

pub type Node {
  Node(
    prefix: BitArray,
    children: dict.Dict(Int, Node),
    values: List(fact.EntityId),
  )
}

Constructors

Values

pub fn bytes_to_value(b: BitArray) -> option.Option(fact.Value)
pub fn delete(
  tree: Art,
  key: fact.Value,
  entity: fact.EntityId,
) -> Art

Remove an entity ID from the tree for a given fact value.

pub fn insert(
  tree: Art,
  key: fact.Value,
  entity: fact.EntityId,
) -> Art

Insert an entity ID into the tree for a given fact value.

pub fn lookup(tree: Art, key: fact.Value) -> List(fact.EntityId)

Lookup all entities associated with a value.

pub fn new() -> Art

Create a new empty ART index.

pub fn search_prefix(
  tree: Art,
  prefix: String,
) -> List(fact.EntityId)
pub fn search_prefix_entries(
  tree: Art,
  prefix: String,
) -> List(#(fact.Value, fact.EntityId))

Search for all entities where the indexed value starts with the given prefix. Returns the Value and EntityId.

Search Document