(optionsOrTopK?: number | SearchQueryOptions)
| 356 | } |
| 357 | |
| 358 | function resolveSearchOptions(optionsOrTopK?: number | SearchQueryOptions): ResolvedSearchQueryOptions { |
| 359 | const raw = typeof optionsOrTopK === "number" ? { topK: optionsOrTopK } : (optionsOrTopK ?? {}); |
| 360 | return { |
| 361 | topK: normalizeTopK(raw.topK, 5), |
| 362 | semanticWeight: normalizeWeight(raw.semanticWeight, 0.72), |
| 363 | keywordWeight: normalizeWeight(raw.keywordWeight, 0.28), |
| 364 | minSemanticScore: normalizeThreshold(raw.minSemanticScore, 0), |
| 365 | minKeywordScore: normalizeThreshold(raw.minKeywordScore, 0), |
| 366 | minCombinedScore: normalizeThreshold(raw.minCombinedScore, 0.1), |
| 367 | requireKeywordMatch: raw.requireKeywordMatch ?? false, |
| 368 | requireSemanticMatch: raw.requireSemanticMatch ?? false, |
| 369 | }; |
| 370 | } |
| 371 | |
| 372 | function getTermCoverage(queryTerms: Set<string>, docTerms: Set<string>): number { |
| 373 | if (queryTerms.size === 0) return 0; |
no test coverage detected