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

17
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) {
// Initialize relevance as numeric value
let relevance = 0; // Assume 0 is 'not relevant'
// Check if the first character of the item's channel matches the first character of the document's channel // Check if the first character of the item's channel matches the first character of the document's channel
let relevance = (item.chan === channelFirstChar) ? 'relevant' : 'not relevant'; if (item.chan === channelFirstChar) {
relevance = 1; // 'relevant'
// Further refine relevance based on v1ds and v0ds // Further refine relevance based on v1ds and v0ds
if (v1ds === item.v1ds && relevance === 'relevant') { if (v1ds === item.v1ds && relevance === 1) {
relevance = 'most relevant'; // v1ds is more relevant than v0ds relevance = 2; // 'most relevant' because v1ds matches
} else if (v0ds === item.v0ds && relevance === 'relevant') { } else if (v0ds === item.v0ds && relevance === 1) {
relevance = 'relevant'; // v0ds is relevant but less so than v1ds // Keep relevance as 1 because v0ds matches but is less relevant than v1ds
} else { }
relevance = 'not relevant'; // Neither v1ds nor v0ds
} }
// Assign the calculated relevance to the item // Assign the calculated relevance to the item