@arsedizioni/ars-utils 21.1.87 → 21.1.88

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