[develop | DONE | CHANGED]: refineFieldResults.service.ts & searchDataproviders.service.ts & searchOrganizations.service.ts & searchProjects.service.ts & searchResearchResults.service.ts: Set cache for default refine queries (without keywords or filters) - not in deposit and datasource specific pages.

This commit is contained in:
Konstantina Galouni 2024-02-08 18:05:27 +02:00
parent f55107b8d5
commit a7294685fb
5 changed files with 13 additions and 8 deletions

View File

@ -57,7 +57,8 @@ export class RefineFieldResultsService {
getField (link:string,fieldName:string, properties:EnvProperties):any{
let url = link+"&refine=true&page=1&size=0";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
return this.http.get((properties.useLongCache && link.includes("sf=") && !link.includes("fq="))? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['refineResults']))
.pipe(map(res => this.parse(res,fieldName)));

View File

@ -47,7 +47,8 @@ export class SearchDataprovidersService {
url += "&page="+(page-1)+"&size="+size;
url += minRef ? "&minRef=true" : "";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
}

View File

@ -80,7 +80,8 @@ export class SearchOrganizationsService {
url += "&page="+(page-1)+"&size="+size;
url += minRef ? "&minRef=true" : "";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));

View File

@ -70,7 +70,8 @@ export class SearchProjectsService {
url += minRef ? "&minRef=true" : "";
// url += "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]));
}

View File

@ -129,7 +129,8 @@ export class SearchResearchResultsService {
url += minRef ? "&minRef=true" : "";
// url += "&format=json";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
// return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
}