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

    Module utils/fuzzScorerLab

    Types - Utils

    CorpusSource

    Where a corpus title was read from.

    CorpusSourceOption

    Which cached stores to build the corpus from. The plain-English aliases ("both", "cache", "results") are accepted alongside the store names so the console call reads naturally.

    CorpusEntry

    One cached product title plus the provenance needed to interpret a score.

    FuzzProbeOptions

    Options for fuzzTest / scoreCorpus.

    ScoredEntry

    A corpus entry annotated with a single score.

    FuzzProbeResult

    Result of scoring a corpus with every active scorer.

    AstProbeOptions

    Options for astTest / evaluateCorpusAst.

    DroppedEntry

    A corpus entry that failed the AST predicate, with the leaves responsible.

    AstProbeResult

    Result of evaluating a corpus against a parsed search query.

    Functions - Utils

    collectCachedTitles

    Builds a deduplicated corpus of product titles from the local IndexedDB caches. No network requests are made — this reads supplier_query_cache (the raw per-supplier result sets, which carry the originating query) and the persisted search_results row (the products currently in the results table).

    listSuppliers

    Lists the distinct supplier names present in a corpus, sorted with the most titles first. Use it to discover the exact spellings the suppliers filter expects.

    scoreCorpus

    Scores every corpus title with every active fuzz scorer, so the scorers can be compared side by side against real product titles. Pure — performs no IO and prints nothing; fuzzTest is the console-facing wrapper.

    renderAst

    Renders a parsed search AST as a readable one-line expression, so a printed probe shows how the query was actually parsed rather than just echoing the raw input.

    explainDrop

    Explains why a title failed an AST predicate: missing phrases are listed verbatim, and a NOT branch that excluded the title is reported as NOT <phrase>. Every drop gets at least one reason, so the dropped table is never blank.

    evaluateCorpusAst

    Evaluates a corpus against an advanced (boolean) search query using the same parseSearchQueryscoreAstMatch path production suppliers take in SupplierBase.fuzzyFilterAst. Pure — performs no IO and prints nothing.

    printFuzzProbe

    Prints a FuzzProbeResult as console tables: one ranked table per scorer, then the merged title-by-scorer matrix, then the biggest scorer disagreements.

    printAstProbe

    Prints an AstProbeResult as console tables: the parsed AST, the ranked survivors, the drops with their failed terms, and any fuzzyWords flips.

    fuzzTest

    Runs a query against every cached product title with all nine fuzz scorers and prints them side by side — the offline equivalent of SupplierBase.fuzzyFilter's dev-only comparison table, but over the whole local cache and with no search.

    astTest

    Runs an advanced (boolean) query against every cached product title through the real parseSearchQueryscoreAstMatch path, showing which titles the predicate keeps, which it drops and why, and which drops hinge on fuzzyWords.