# `Arcana.Search`
[🔗](https://github.com/georgeguimaraes/arcana/blob/main/lib/arcana/search.ex#L1)

Search functionality for Arcana.

Provides semantic, fulltext, and hybrid search modes with optional
GraphRAG enhancement using Reciprocal Rank Fusion (RRF).

# `rewrite_query`

Rewrites a query using a provided rewriter function.

Query rewriting can improve retrieval by expanding abbreviations,
adding synonyms, or reformulating the query for better matching.

## Options

  * `:rewriter` - A function that takes a query and returns {:ok, rewritten} or {:error, reason}

# `search`

Searches for chunks similar to the query.

Returns `{:ok, results}` where results is a list of maps containing chunk
information and similarity scores, or `{:error, reason}` on failure.

## Options

  * `:repo` - The Ecto repo to use (required for pgvector backend)
  * `:limit` - Maximum number of results (default: 10)
  * `:source_id` - Filter results to a specific source
  * `:threshold` - Minimum similarity score (default: 0.0)
  * `:mode` - Search mode: `:semantic` (default), `:fulltext`, or `:hybrid`
  * `:collection` - Filter results to a specific collection by name
  * `:vector_store` - Override the configured vector store backend
  * `:semantic_weight` - Weight for semantic scores in hybrid mode (default: 0.5)
  * `:fulltext_weight` - Weight for fulltext scores in hybrid mode (default: 0.5)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
