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

Function computeCombinedScore

src/core/embeddings.ts:398–403  ·  view source on GitHub ↗
(semanticScore: number, keywordScore: number, options: ResolvedSearchQueryOptions)

Source from the content-addressed store, hash-verified

396}
397
398function computeCombinedScore(semanticScore: number, keywordScore: number, options: ResolvedSearchQueryOptions): number {
399 const semanticComponent = Math.max(semanticScore, 0);
400 const totalWeight = options.semanticWeight + options.keywordWeight;
401 if (totalWeight <= 0) return semanticComponent;
402 return clamp01((options.semanticWeight * semanticComponent + options.keywordWeight * keywordScore) / totalWeight);
403}
404
405async function loadCache(rootDir: string): Promise<EmbeddingCache> {
406 return loadEmbeddingCache(rootDir, CACHE_FILE);

Callers 1

searchMethod · 0.85

Calls 1

clamp01Function · 0.70

Tested by

no test coverage detected