Project Files
src / services / ranker.ts
export function scoreContent(
query: string,
content: string
): number {
const words =
query.toLowerCase().split(" ");
const lower =
content.toLowerCase();
let score = 0;
for (const word of words) {
if (lower.includes(word)) {
score += 10;
}
}
score += Math.min(
content.length / 500,
20
);
return score;
}