@arsedizioni/ars-utils 21.1.83 → 21.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1299,14 +1299,15 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
1299
1299
|
this.dialogService.error(r.message);
|
|
1300
1300
|
else {
|
|
1301
1301
|
if (r.value?.items && r.value?.items.length > 0) {
|
|
1302
|
+
let maxScore = 0;
|
|
1302
1303
|
r.value.items[0].anchors.forEach(n => {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1304
|
+
if (n.score > maxScore) {
|
|
1305
|
+
maxScore = n.score;
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
maxScore = maxScore * 1.2; // add 20% treshold
|
|
1309
|
+
r.value.items[0].anchors.forEach(n => {
|
|
1310
|
+
let score = n.score / maxScore || 1;
|
|
1310
1311
|
n.score = score;
|
|
1311
1312
|
n.veryRelevant = score > 0.7;
|
|
1312
1313
|
});
|
|
@@ -2169,6 +2170,13 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
|
|
|
2169
2170
|
if (n.anchors) {
|
|
2170
2171
|
let anchorType;
|
|
2171
2172
|
let anchors = [];
|
|
2173
|
+
let maxScore = 0;
|
|
2174
|
+
n.anchors.forEach(a => {
|
|
2175
|
+
if (a.score > maxScore) {
|
|
2176
|
+
maxScore = a.score;
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
maxScore = maxScore * 1.2; // add 20% treshold
|
|
2172
2180
|
n.anchors.forEach(a => {
|
|
2173
2181
|
if (a.type === 20)
|
|
2174
2182
|
return;
|
|
@@ -2177,13 +2185,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
|
|
|
2177
2185
|
anchors.push({ text: a.typeDescription });
|
|
2178
2186
|
anchorType = a.type;
|
|
2179
2187
|
}
|
|
2180
|
-
let score = a.score;
|
|
2181
|
-
if (score > 7)
|
|
2182
|
-
score -= 7;
|
|
2183
|
-
else if (score > 5)
|
|
2184
|
-
score -= 5;
|
|
2185
|
-
else if (score > 3)
|
|
2186
|
-
score -= 3;
|
|
2188
|
+
let score = a.score / maxScore || 1;
|
|
2187
2189
|
anchors.push({
|
|
2188
2190
|
text: a.text,
|
|
2189
2191
|
title: a.title,
|