Skip to main content

build_query_scoped

Function build_query_scoped 

Source
pub fn build_query_scoped(
    index: &Index,
    schema: &TextSchema,
    seed_chars: usize,
    request: &TextSearchRequest,
    predicates: &[Vec<u8>],
) -> Result<Box<dyn Query>, TextIndexError>
Expand description

build_query conjoined with a predicate-set filter on the stored predicate.

predicates are the encoded predicate bytes a document carries (the write path stores encode_term_bytes of the predicate term). The drain returns only literals that appear under at least one of them:

Must( mode query ) ∧ Must( Should( term(p₁), …, term(pₙ) ) )

The inner BooleanQuery holds only Should clauses, and Tantivy defaults a should-only boolean to minimum_number_should_match = 1 (the Elasticsearch convention), so a document must carry one of the named predicates. An empty predicates means no predicate restriction: the mode query alone decides.

The subject resolve passes the request’s whole predicate set in one call. A literal has one text/lang/seed analysis regardless of which predicate it appears under, so the union of per-predicate drains is exactly this one query, and the same set then scopes the OPSG walk.