MCPcopy Create free account
hub / github.com/PatrickSys/codebase-context / generateRelevanceReason

Method generateRelevanceReason

src/core/search.ts:1176–1194  ·  view source on GitHub ↗
(chunk: CodeChunk, query: string)

Source from the content-addressed store, hash-verified

1174 }
1175
1176 private generateRelevanceReason(chunk: CodeChunk, query: string): string {
1177 const reasons: string[] = [];
1178
1179 if (chunk.componentType) {
1180 reasons.push(`${chunk.componentType}`);
1181 }
1182
1183 if (chunk.layer) {
1184 reasons.push(`${chunk.layer} layer`);
1185 }
1186
1187 const queryLower = query.toLowerCase();
1188 const matchingTags = (chunk.tags || []).filter((tag) => queryLower.includes(tag.toLowerCase()));
1189 if (matchingTags.length > 0) {
1190 reasons.push(`tags: ${matchingTags.join(', ')}`);
1191 }
1192
1193 return reasons.length > 0 ? reasons.join('; ') : 'content match';
1194 }
1195
1196 async getChunkCount(): Promise<number> {
1197 if (this.storageProvider) {

Callers 1

scoreAndSortResultsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected