ChemPal Documentation - v1.6.0
    Preparing search index...

    Module utils/search-query/highlightSearchQuery

    Search - Utils

    HighlightState

    How a typed query is being interpreted, driving the search box's visual treatment.

    HighlightTokenKind

    The token classes the highlighter colorizes.

    HighlightToken

    A single highlightable span over the raw query string.

    HighlightResult

    Result of highlighting a query: markup plus how the query is interpreted.

    tokenizeWithSpans

    Splits a raw query into highlightable tokens that carry source offsets and, unlike the parser's tokenize, preserve whitespace and the quote characters so the rendered markup round-trips exactly to the input. Bare words matching OPERATOR_WORDS are tagged as keyword; parens carry a nesting depth for rainbow coloring; unmatched parens and unterminated quotes are flagged with error.

    highlightSearchQuery

    Highlights a search query for the search box, returning token-colored markup plus how the query is interpreted. The result mirrors parseSearchQuery's own grammar:

    • "plain" — no advanced syntax (rendered without coloring by the input component).
    • "advanced" — a valid boolean query with at least one inclusive term.
    • "error" — advanced syntax that is malformed (e.g. unbalanced parens) or has no inclusive constraint (only NOT/exclusions), which would match almost everything.