Skip to content

Commit 74c5434

Browse files
authored
Merge pull request #47 from Srujithchaithanya1/fix/pageIndexing
fixes Search Pagination Indexing Error
2 parents b76997c + 2508366 commit 74c5434

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

projects/website-angular/src/app/search/search.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ export class SearchComponent implements OnInit, OnDestroy, AfterViewInit {
201201
// Successful API response - check if we have results
202202
this.results = results as SearchResult;
203203
this.facets = facets;
204-
this.totalPages = Math.ceil(((results as SearchResult).numberOfMatches || 0) / this.pageSize);
204+
this.totalPages = this.totalPages = Math.max(
205+
...(results.results || []).map(group =>
206+
Math.ceil((group.entriesCount || 0) / this.pageSize)
207+
),
208+
0
209+
);
205210
this.hasNoResults = ((results as SearchResult).numberOfMatches || 0) === 0;
206211
this.error = '';
207212
}

0 commit comments

Comments
 (0)