barrel_ngram_selector_dense (barrel_ngram v0.7.1)

View Source

Dense gram selector: every overlapping byte trigram.

This is the reference selector. It emits every trigram of the input, so a literal's grams are always a subset of its containing document's grams, and every gram is reliable to intersect over. It is also the oracle against which the content-defined selector is validated.

Summary

Functions

Dense indexes every trigram, so any mandatory trigram is present.

For the dense selector every gram is reliable. Literals shorter than a trigram carry no grams to intersect, so the planner must fall back to a brute-force scan of the live set.

Every overlapping trigram of Bytes, deduplicated and ascending. Inputs shorter than three bytes contribute no grams. Options are unused.

Functions

covers_all_grams(Opts)

-spec covers_all_grams(map()) -> boolean().

Dense indexes every trigram, so any mandatory trigram is present.

reliable_grams(Query, Opts)

-spec reliable_grams(binary(), map()) -> barrel_ngram_selector:reliable().

For the dense selector every gram is reliable. Literals shorter than a trigram carry no grams to intersect, so the planner must fall back to a brute-force scan of the live set.

select_grams(Bytes, Opts)

-spec select_grams(binary(), map()) -> [barrel_ngram_selector:gram()].

Every overlapping trigram of Bytes, deduplicated and ascending. Inputs shorter than three bytes contribute no grams. Options are unused.