@arsedizioni/ars-utils 21.1.87 → 21.1.89

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,15 +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
+ let minScore = 10;
1303
1303
  r.value.items[0].anchors.forEach(n => {
1304
- if (n.score > maxScore) {
1305
- maxScore = n.score;
1304
+ if (n.score < minScore) {
1305
+ minScore = n.score;
1306
1306
  }
1307
1307
  });
1308
- maxScore = maxScore * 1.1; // add 10% treshold
1308
+ minScore = Math.trunc(minScore);
1309
1309
  r.value.items[0].anchors.forEach(n => {
1310
- let score = n.score / maxScore || 1;
1310
+ let score = n.score - minScore;
1311
1311
  n.score = score;
1312
1312
  n.veryRelevant = score > 0.7;
1313
1313
  });
@@ -2170,13 +2170,6 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
2170
2170
  if (n.anchors) {
2171
2171
  let anchorType;
2172
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.1; // add 10% treshold
2180
2173
  n.anchors.forEach(a => {
2181
2174
  if (a.type === 20)
2182
2175
  return;
@@ -2185,14 +2178,13 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
2185
2178
  anchors.push({ text: a.typeDescription });
2186
2179
  anchorType = a.type;
2187
2180
  }
2188
- let score = a.score / maxScore || 1;
2189
2181
  anchors.push({
2190
2182
  text: a.text,
2191
2183
  title: a.title,
2192
2184
  documentId: a.documentId,
2193
2185
  uri: a.uri,
2194
- veryRelevant: score > 0.7,
2195
- score: score,
2186
+ veryRelevant: a.score > 0.7,
2187
+ score: a.score,
2196
2188
  chunk: a.chunk
2197
2189
  });
2198
2190
  });