The search string; may use AND/OR/NOT and parentheses.
source ("cache" / "results" / "both"), suppliers, limit
(0 = all), ranking scorer, threshold, fuzzyWords, and compareFuzzyWords.
The full evaluated result, also printed unless print: false.
// In the console:
const result = await chempal.astTest("sodium AND NOT borohydride");
result.astText; // => '(sodium AND NOT borohydride)'
result.matched.length; // => 37
result.dropped[0].failedTerms; // => ['sodium']
await chempal.astTest("acid OR base", { fuzzyWords: false, threshold: 70 });
await chempal.astTest("sodium", { suppliers: "loud", source: "cache", limit: 0 });
export async function astTest(
query: string,
options: AstProbeOptions = {},
): Promise<AstProbeResult> {
const corpus = await collectCachedTitles(options.source);
const result = evaluateCorpusAst(query, corpus, options);
if (options.print !== false) {
printAstProbe(result, options.limit);
}
return result;
}
Runs an advanced (boolean) query against every cached product title through the real
parseSearchQuery→scoreAstMatchpath, showing which titles the predicate keeps, which it drops and why, and which drops hinge onfuzzyWords.