caveat-cli 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14404,7 +14404,9 @@ function findCaveatsForPrompt(db, prompt, opts = {}) {
14404
14404
  entry = {
14405
14405
  groups: /* @__PURE__ */ new Set(),
14406
14406
  symptomTokens: /* @__PURE__ */ new Set(),
14407
+ topicalTokens: /* @__PURE__ */ new Set(),
14407
14408
  symptomLower: typeof row.symptom_text === "string" && row.symptom_text.length > 0 ? row.symptom_text.toLowerCase() : null,
14409
+ topicalLower: typeof row.topical_text === "string" && row.topical_text.length > 0 ? row.topical_text.toLowerCase() : null,
14408
14410
  row
14409
14411
  };
14410
14412
  perEntry.set(row.rowid, entry);
@@ -14413,6 +14415,9 @@ function findCaveatsForPrompt(db, prompt, opts = {}) {
14413
14415
  if (entry.symptomLower !== null && tokenAppearsIn(tokLower, entry.symptomLower)) {
14414
14416
  entry.symptomTokens.add(tokLower);
14415
14417
  }
14418
+ if (entry.topicalLower !== null && tokenAppearsIn(tokLower, entry.topicalLower)) {
14419
+ entry.topicalTokens.add(tokLower);
14420
+ }
14416
14421
  }
14417
14422
  }
14418
14423
  const validDfs = [...tokenDf.entries()].filter(([, df]) => df > 0);
@@ -14421,9 +14426,10 @@ function findCaveatsForPrompt(db, prompt, opts = {}) {
14421
14426
  for (const [, df] of validDfs) if (df < minDf) minDf = df;
14422
14427
  const rareTokens = new Set(validDfs.filter(([, df]) => df === minDf).map(([t2]) => t2));
14423
14428
  const limit = opts.limit ?? DEFAULT_REMINDER_HIT_LIMIT;
14424
- return [...perEntry.values()].filter(({ groups, symptomTokens }) => {
14429
+ return [...perEntry.values()].filter(({ groups, symptomTokens, topicalTokens }) => {
14425
14430
  if (groups.size < minMatches) return false;
14426
- for (const t2 of symptomTokens) if (rareTokens.has(t2)) return true;
14431
+ if (symptomTokens.size === 0) return false;
14432
+ for (const t2 of topicalTokens) if (rareTokens.has(t2)) return true;
14427
14433
  return false;
14428
14434
  }).sort((a, b2) => b2.groups.size - a.groups.size).slice(0, limit).map(({ row }) => toSearchResult2(row));
14429
14435
  }
@@ -15312,4 +15318,4 @@ strip-bom-string/index.js:
15312
15318
  js-yaml/dist/js-yaml.mjs:
15313
15319
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
15314
15320
  */
15315
- //# sourceMappingURL=chunk-CSXD73IX.js.map
15321
+ //# sourceMappingURL=chunk-EH3S6X6X.js.map