MCPcopy Index your code
hub / github.com/simstudioai/sim / getTitleBoost

Function getTitleBoost

apps/docs/app/api/search/route.ts:153–164  ·  view source on GitHub ↗
(result: ResultWithRRF)

Source from the content-addressed store, hash-verified

151
152 const queryLower = query.toLowerCase()
153 const getTitleBoost = (result: ResultWithRRF): number => {
154 const fileName = result.sourceDocument
155 .replace('.mdx', '')
156 .split('/')
157 .pop()
158 ?.toLowerCase()
159 ?.replace(/_/g, ' ')
160
161 if (fileName === queryLower) return 0.01
162 if (fileName?.includes(queryLower)) return 0.005
163 return 0
164 }
165
166 localeFilteredResults.sort((a, b) => {
167 return b.rrfScore + getTitleBoost(b) - (a.rrfScore + getTitleBoost(a))

Callers 1

GETFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected