mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: adjust boosting scores to work better
This commit is contained in:
@@ -9,7 +9,6 @@ const fetchSubjects = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
console.debug("[Subjects job] API response:", data);
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -19,14 +18,13 @@ export const subjectsJob: Job = {
|
|||||||
renderComponentId: "subject",
|
renderComponentId: "subject",
|
||||||
frequency: "pageLoad",
|
frequency: "pageLoad",
|
||||||
boostCriteria: (item, searchTerm) => {
|
boostCriteria: (item, searchTerm) => {
|
||||||
let score = 0;
|
if (searchTerm == "") {
|
||||||
const hasSubjectMatch = searchTerm.toLowerCase().includes(item.metadata.subjectName.toLowerCase()) || searchTerm.toLowerCase().includes(item.metadata.subjectCode.toLowerCase());
|
return -100;
|
||||||
if (hasSubjectMatch) {
|
|
||||||
score += 20; // Boost score for direct subject matches
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let score = 0;
|
||||||
if (item.metadata.isActive) {
|
if (item.metadata.isActive) {
|
||||||
score += 15; // Boost for active subjects
|
score += 1; // Boost for active subjects
|
||||||
} else {
|
} else {
|
||||||
score -= 50; // Penalty for inactive subjects
|
score -= 50; // Penalty for inactive subjects
|
||||||
}
|
}
|
||||||
@@ -121,10 +119,6 @@ export const subjectsJob: Job = {
|
|||||||
renderComponentId: "subject",
|
renderComponentId: "subject",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Log all subject items during indexing
|
|
||||||
console.log('Indexing subject:', assessmentsItem.text, assessmentsItem.metadata.isActive);
|
|
||||||
console.log('Indexing subject:', courseItem.text, courseItem.metadata.isActive);
|
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
assessmentsItem,
|
assessmentsItem,
|
||||||
courseItem
|
courseItem
|
||||||
|
|||||||
Reference in New Issue
Block a user