MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getScore

Method getScore

search/search.ts:543–555  ·  view source on GitHub ↗
(video: Api.Message)

Source from the content-addressed store, hash-verified

541 if (validVideos.length > 1) {
542 const queryNormalized = this.normalizeSearchTerm(query || "");
543 const getScore = (video: Api.Message): number => {
544 let score = 0;
545 const fileNameAttr = video.video?.attributes.find((attr: any): attr is Api.DocumentAttributeFilename => attr instanceof Api.DocumentAttributeFilename);
546 if (fileNameAttr?.fileName) {
547 const normalizedFileName = this.normalizeSearchTerm(fileNameAttr.fileName);
548 if (normalizedFileName.includes(queryNormalized)) score += 100;
549 }
550 if (video.message) {
551 const normalizedMessage = this.normalizeSearchTerm(video.message);
552 if (normalizedMessage.includes(queryNormalized)) score += 50;
553 }
554 return score;
555 };
556
557 validVideos.sort((a, b) => {
558 const scoreA = getScore(a);

Callers

nothing calls this directly

Calls 1

normalizeSearchTermMethod · 0.95

Tested by

no test coverage detected