Muninn.IndexReader (Muninn v0.5.5)
View SourceIndexReader provides access to search an index.
The IndexReader is the entry point for searching. It manages the underlying index segments and provides searchers for executing queries.
Usage
{:ok, index} = Muninn.Index.open("/path/to/index")
{:ok, reader} = Muninn.IndexReader.new(index)
{:ok, searcher} = Muninn.Searcher.new(reader)Lifecycle
Readers are automatically managed and cleaned up by the BEAM garbage collector. No explicit close is required.
Summary
Functions
Creates a new IndexReader for the given index.
Types
@type t() :: reference()
Functions
Creates a new IndexReader for the given index.
The reader provides access to search the index and retrieve documents.
Parameters
index- The index to create a reader for
Returns
{:ok, reader}- Successfully created reader{:error, reason}- Failed to create reader
Examples
{:ok, index} = Muninn.Index.open("/tmp/my_index")
{:ok, reader} = Muninn.IndexReader.new(index)