From 250836607ee1a92baad69ac5de89242a23a1cf2c Mon Sep 17 00:00:00 2001 From: Srujithchaithanya1 Date: Mon, 30 Mar 2026 22:02:49 +0530 Subject: [PATCH] fixes Search Pagination Indexing Error Fixes #10 --- .../website-angular/src/app/search/search.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/website-angular/src/app/search/search.component.ts b/projects/website-angular/src/app/search/search.component.ts index 8f8abb4..48ba68c 100644 --- a/projects/website-angular/src/app/search/search.component.ts +++ b/projects/website-angular/src/app/search/search.component.ts @@ -201,7 +201,12 @@ export class SearchComponent implements OnInit, OnDestroy, AfterViewInit { // Successful API response - check if we have results this.results = results as SearchResult; this.facets = facets; - this.totalPages = Math.ceil(((results as SearchResult).numberOfMatches || 0) / this.pageSize); + this.totalPages = this.totalPages = Math.max( + ...(results.results || []).map(group => + Math.ceil((group.entriesCount || 0) / this.pageSize) + ), + 0 + ); this.hasNoResults = ((results as SearchResult).numberOfMatches || 0) === 0; this.error = ''; }