@arsedizioni/ars-utils 21.1.38 → 21.1.39
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.
|
@@ -1273,51 +1273,49 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
|
|
|
1273
1273
|
updateRelevants(anchors) {
|
|
1274
1274
|
if (anchors) {
|
|
1275
1275
|
console.log("Relevants items: " + this.relevants.items.length + " hits: " + this.relevants.hits);
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
text: a.text,
|
|
1286
|
-
uri: "__SEARCH_HIT_" + a.index
|
|
1287
|
-
});
|
|
1276
|
+
let items = [];
|
|
1277
|
+
console.log("Relevants items: " + this.relevants.items.length + " hits: " + this.relevants.hits);
|
|
1278
|
+
anchors.forEach(a => {
|
|
1279
|
+
items.push({
|
|
1280
|
+
chunk: a.chunkId,
|
|
1281
|
+
score: ClipperSearchUtils.getRankFromChar(a.chunkRank),
|
|
1282
|
+
veryRelevant: a.chunkRank.toUpperCase() === 'A',
|
|
1283
|
+
text: a.text,
|
|
1284
|
+
uri: "__SEARCH_HIT_" + a.index
|
|
1288
1285
|
});
|
|
1289
|
-
|
|
1290
|
-
|
|
1286
|
+
});
|
|
1287
|
+
this.relevants.items = items;
|
|
1288
|
+
this.hasRelevants.set(items.length > 0);
|
|
1289
|
+
console.log("Relevants items: " + this.relevants.items.length + " hits: " + this.relevants.hits);
|
|
1290
|
+
this.handleRelevantsPaneVisibility();
|
|
1291
|
+
this.changeDetector.markForCheck();
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
const query = this.lastQuery;
|
|
1295
|
+
if (!query ||
|
|
1296
|
+
query.length === 0 ||
|
|
1297
|
+
query === ' ') {
|
|
1291
1298
|
this.handleRelevantsPaneVisibility();
|
|
1292
|
-
this.changeDetector.markForCheck();
|
|
1293
1299
|
}
|
|
1294
1300
|
else {
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
.subscribe(r => {
|
|
1309
|
-
if (!r.success)
|
|
1310
|
-
this.dialogService.error(r.message);
|
|
1311
|
-
else {
|
|
1312
|
-
if (r.value?.items && r.value?.items.length > 0) {
|
|
1313
|
-
this.relevants.items = r.value.items[0].chunks.length > 0 ? r.value.items[0].chunks : r.value.items[0].anchors;
|
|
1314
|
-
this.hasRelevants.set(this.relevants.items?.length > 0);
|
|
1315
|
-
}
|
|
1316
|
-
this.handleRelevantsPaneVisibility();
|
|
1317
|
-
this.changeDetector.markForCheck();
|
|
1301
|
+
let params = new ClipperSearchParams();
|
|
1302
|
+
params.id = this.lastDocument.documentId ?? this.lastDocument.id;
|
|
1303
|
+
params.text = query;
|
|
1304
|
+
params.count = 1;
|
|
1305
|
+
this.clipperService
|
|
1306
|
+
.query(params)
|
|
1307
|
+
.subscribe(r => {
|
|
1308
|
+
if (!r.success)
|
|
1309
|
+
this.dialogService.error(r.message);
|
|
1310
|
+
else {
|
|
1311
|
+
if (r.value?.items && r.value?.items.length > 0) {
|
|
1312
|
+
this.relevants.items = r.value.items[0].chunks.length > 0 ? r.value.items[0].chunks : r.value.items[0].anchors;
|
|
1313
|
+
this.hasRelevants.set(this.relevants.items?.length > 0);
|
|
1318
1314
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1315
|
+
this.handleRelevantsPaneVisibility();
|
|
1316
|
+
this.changeDetector.markForCheck();
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1321
1319
|
}
|
|
1322
1320
|
}
|
|
1323
1321
|
}
|