@arsedizioni/ars-utils 21.1.72 → 21.1.73

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.
@@ -24,7 +24,7 @@ import * as i5 from '@angular/material/slide-toggle';
24
24
  import { MatSlideToggleModule } from '@angular/material/slide-toggle';
25
25
  import * as i3 from '@angular/material/tooltip';
26
26
  import { MatTooltipModule } from '@angular/material/tooltip';
27
- import { ClipperService, ClipperMessages, ClipperModel, ClipperQueryReferencesMode, ClipperModule, ClipperUtils, ClipperSearchUtils, ClipperSearchFacetsSnapshot, ClipperFacet, ClipperSelectionMode, ClipperSearchResult, ClipperSearchParams, ClipperSort, ClipperQueryDocumentFlags, ClipperSources, ClipperDocumentChangeReasons, ClipperChannel, ClipperSectors, ClipperRegions, ClipperAuthors, ClipperSectorTypes } from '@arsedizioni/ars-utils/clipper.common';
27
+ import { ClipperService, ClipperMessages, ClipperModel, ClipperQueryReferencesMode, ClipperModule, ClipperUtils, ClipperSearchParams, ClipperSearchUtils, ClipperSearchFacetsSnapshot, ClipperFacet, ClipperSelectionMode, ClipperSearchResult, ClipperSort, ClipperQueryDocumentFlags, ClipperSources, ClipperDocumentChangeReasons, ClipperChannel, ClipperSectors, ClipperRegions, ClipperAuthors, ClipperSectorTypes } from '@arsedizioni/ars-utils/clipper.common';
28
28
  import * as i19 from '@arsedizioni/ars-utils/core';
29
29
  import { SystemUtils, BroadcastService, SafeUrlPipe, DateInterval, ThemeService, ScreenService, DateFormat, FormatPipe, SelectableModel, ArsCoreModule } from '@arsedizioni/ars-utils/core';
30
30
  import { FlexLayoutModule, FlexModule } from '@ngbracket/ngx-layout';
@@ -926,7 +926,9 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
926
926
  break;
927
927
  case 'hits':
928
928
  this.relevants.hits = data.total;
929
- //this.updateRelevants2();
929
+ if (data.update) {
930
+ this.updateRelevants();
931
+ }
930
932
  break;
931
933
  case 'hits2':
932
934
  this.relevants.chunks = data.total;
@@ -1278,52 +1280,34 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
1278
1280
  * Update relevant items
1279
1281
  * @param anchors: the optional anchor list
1280
1282
  */
1281
- /*
1282
- private updateRelevants(anchors?: ClipperDocumentRelevantChunkHit[]) {
1283
- if (anchors) {
1284
- let items: ClipperDocumentAnchorInfo[] = [];
1285
- anchors.forEach(a => {
1286
- items.push({
1287
- chunk: a.chunkId,
1288
- score: ClipperSearchUtils.getRankFromChar(a.chunkRank),
1289
- veryRelevant: a.chunkRank.toUpperCase() === 'A',
1290
- title: a.text,
1291
- uri: "__SEARCH_" + a.index
1292
- });
1293
- });
1294
- this.relevants.items = items;
1295
- this.hasRelevants.set(items.length > 0);
1296
- this.handleRelevantsPaneVisibility();
1297
- this.changeDetector.markForCheck();
1298
- } else {
1283
+ updateRelevants() {
1299
1284
  const query = this.lastQuery;
1300
- if (
1301
- !query ||
1302
- query.length === 0 ||
1303
- query === ' ') {
1304
- this.handleRelevantsPaneVisibility();
1305
- } else {
1306
- let params = new ClipperSearchParams();
1307
- params.id = this.lastDocument.documentId ?? this.lastDocument.id;
1308
- params.text = query;
1309
- params.count = 1;
1310
- this.clipperService
1311
- .query(params)
1312
- .subscribe(r => {
1313
- if (!r.success) this.dialogService.error(r.message);
1314
- else {
1315
- if (r.value?.items && r.value?.items.length > 0) {
1316
- this.relevants.items = r.value.items[0].chunks.length > 0 ? r.value.items[0].chunks : r.value.items[0].anchors;
1317
- this.hasRelevants.set(this.relevants.items?.length > 0);
1285
+ if (!query ||
1286
+ query.length === 0 ||
1287
+ query === ' ') {
1288
+ this.handleRelevantsPaneVisibility();
1289
+ }
1290
+ else {
1291
+ let params = new ClipperSearchParams();
1292
+ params.id = this.lastDocument.documentId ?? this.lastDocument.id;
1293
+ params.text = query;
1294
+ params.count = 1;
1295
+ this.clipperService
1296
+ .query(params)
1297
+ .subscribe(r => {
1298
+ if (!r.success)
1299
+ this.dialogService.error(r.message);
1300
+ else {
1301
+ if (r.value?.items && r.value?.items.length > 0) {
1302
+ this.relevants.items = r.value.items[0].chunks.length > 0 ? r.value.items[0].chunks : r.value.items[0].anchors;
1303
+ this.hasRelevants.set(this.relevants.items?.length > 0);
1304
+ }
1305
+ this.handleRelevantsPaneVisibility();
1306
+ this.changeDetector.markForCheck();
1318
1307
  }
1319
- this.handleRelevantsPaneVisibility();
1320
- this.changeDetector.markForCheck();
1321
- }
1322
1308
  });
1323
1309
  }
1324
- }
1325
1310
  }
1326
- */
1327
1311
  /**
1328
1312
  * Update relevant items
1329
1313
  * @param anchors: the optional anchor list
@@ -3830,9 +3814,6 @@ class ClipperBrowserComponent extends ClipperSearchResultManager {
3830
3814
  this.filterParams.sourceFromDate = this.sourceInterval.fromAsDate;
3831
3815
  this.filterParams.sourceToDate = this.sourceInterval.toAsDate;
3832
3816
  }
3833
- if (newSearch) {
3834
- this.filterParams.first = 0;
3835
- }
3836
3817
  let newParams = new ClipperSearchParams();
3837
3818
  if ((this.filterParams.modules?.length ?? 0) > 0) {
3838
3819
  newParams.first = this.filterParams.first;
@@ -3909,6 +3890,11 @@ class ClipperBrowserComponent extends ClipperSearchResultManager {
3909
3890
  newParams.types = [{ name: '?', value: this.filterParams.type }];
3910
3891
  }
3911
3892
  }
3893
+ // New saerch reset pagination
3894
+ if (newSearch) {
3895
+ newParams.first = 0;
3896
+ this.filterParams.first = 0;
3897
+ }
3912
3898
  // Setup sort options
3913
3899
  this.sortOptions = ClipperUtils.getClipperAvailableSortOptions(this.filterParams.modules, newParams);
3914
3900
  if (newParams.text && newSearch) {