MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / resolveSearchOptions

Function resolveSearchOptions

src/core/embeddings.ts:358–370  ·  view source on GitHub ↗
(optionsOrTopK?: number | SearchQueryOptions)

Source from the content-addressed store, hash-verified

356}
357
358function 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
372function getTermCoverage(queryTerms: Set<string>, docTerms: Set<string>): number {
373 if (queryTerms.size === 0) return 0;

Callers 1

searchMethod · 0.85

Calls 3

normalizeTopKFunction · 0.85
normalizeThresholdFunction · 0.85
normalizeWeightFunction · 0.70

Tested by

no test coverage detected