barrel_ngram_source_mem (barrel_ngram v0.9.0)

View Source

In-memory barrel_ngram_source implementation.

For tests and small corpora: InitArg is a #{DocId => binary()} map of document text, held directly as State (no process, no copy beyond the map itself).

Summary

Functions

doc_size(Docs, DocId)

-spec doc_size(#{binary() => binary()}, binary()) -> {ok, non_neg_integer()} | {error, term()}.

pread(Docs, DocId, Offset, Len)

-spec pread(#{binary() => binary()}, binary(), non_neg_integer(), non_neg_integer()) ->
               {ok, binary()} | {error, term()}.