search tab: show all results / don't slice the array

Fetch research results: keep all results in allResults field (for community results case)
This commit is contained in:
argirok 2023-10-16 12:11:47 +03:00
parent 9226a5975d
commit aa0ec0b06f
2 changed files with 5 additions and 8 deletions

View File

@ -12,6 +12,7 @@ export class FetchResearchResults {
private errorMessages: ErrorMessagesComponent;
public results =[];
public allResults =[]; // in case of paging
public requestComplete: Subject<void>;
@ -88,7 +89,8 @@ export class FetchResearchResults {
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults(resultType, "", page, size, "resultdateofacceptance,descending", properties, "&type=results&fq=communityid=" + communityId +(contextId?'&fq=categoryid=' + encodeURIComponent(contextId):'')).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.allResults = data[1];
this.results = data[1].slice(0, 5) ;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){

View File

@ -1,4 +1,4 @@
import {Component, Input} from '@angular/core';
import {Component, Input, SimpleChanges} from '@angular/core';
import {EnvProperties} from "../../properties/env-properties";
import {ErrorCodes} from "../../properties/errorCodes";
import {OpenaireEntities} from "../../properties/searchFields";
@ -41,7 +41,7 @@ import {StringUtils} from "../../string-utils.class";
<ng-container *ngIf="fetch.searchUtils.status == errorCodes.DONE">
<search-result [properties]="properties"
[results]="results"
[results]="fetch.results"
[status]="fetch.searchUtils.status"
[type]="resultType" [showEnermaps]="showEnermaps" [prevPath]="prevPath">
</search-result>
@ -67,7 +67,6 @@ export class SearchTabComponent {
@Input() properties: EnvProperties;
@Input() customTitle;
@Input() showEnermaps: boolean;
@Input() currentPage: number = null;
public errorCodes: ErrorCodes = new ErrorCodes();
@ -75,10 +74,6 @@ export class SearchTabComponent {
return StringUtils.getEntityName(entityType, true);
}
get results() {
return this.currentPage ? this.fetch.results.slice((this.currentPage - 1) * this.searchNumber, this.currentPage * this.searchNumber) : this.fetch.results;
}
get paramsForExternalUrl() {
let parameters: string = "";
Object.keys(this.params).forEach(paramKey => {