vault backup: 2023-11-06 14:33:05

This commit is contained in:
Paul Trowbridge 2023-11-06 14:33:06 -05:00
parent 77c7162ecd
commit 48e3e2691e

21
api.ts
View File

@ -45,16 +45,19 @@ function apply_guidance(doc: any) {
function assignRelevanceIndicator(items, channelFirstChar, v1ds, v0ds) { function assignRelevanceIndicator(items, channelFirstChar, v1ds, v0ds) {
for (let item of items) { for (let item of items) {
// Check if the first character of the item's channel matches the first character of the document's channel // Initialize relevance as numeric value
let relevance = (item.chan === channelFirstChar) ? 'relevant' : 'not relevant'; let relevance = 0; // Assume 0 is 'not relevant'
// Further refine relevance based on v1ds and v0ds // Check if the first character of the item's channel matches the first character of the document's channel
if (v1ds === item.v1ds && relevance === 'relevant') { if (item.chan === channelFirstChar) {
relevance = 'most relevant'; // v1ds is more relevant than v0ds relevance = 1; // 'relevant'
} else if (v0ds === item.v0ds && relevance === 'relevant') {
relevance = 'relevant'; // v0ds is relevant but less so than v1ds // Further refine relevance based on v1ds and v0ds
} else { if (v1ds === item.v1ds && relevance === 1) {
relevance = 'not relevant'; // Neither v1ds nor v0ds relevance = 2; // 'most relevant' because v1ds matches
} else if (v0ds === item.v0ds && relevance === 1) {
// Keep relevance as 1 because v0ds matches but is less relevant than v1ds
}
} }
// Assign the calculated relevance to the item // Assign the calculated relevance to the item