From 0200a0922c379ae0e4aca7a4610e954366a7c477 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 19 Feb 2020 15:35:48 +0000 Subject: [PATCH] [Library|Trunk] New Search: add search All component update Search pages to work from search all component git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58115 d315682c-612b-4755-9ff5-7f18f6832af3 --- searchPages/find/searchAll.component.html | 99 ++++ searchPages/find/searchAll.component.ts | 523 ++++++++++++++++++ searchPages/find/searchAll.module.ts | 43 ++ searchPages/searchDataProviders.component.ts | 27 +- searchPages/searchOrganizations.component.ts | 31 +- searchPages/searchProjects.component.ts | 30 +- .../searchResearchResults.component.ts | 48 +- .../advancedSearchForm.component.html | 4 +- .../advancedSearchForm.component.ts | 2 +- .../entitiesSelection.component.ts | 2 +- .../searchUtils/newSearchPage.component.html | 16 +- .../searchUtils/newSearchPage.component.ts | 6 +- services/searchResearchResults.service.ts | 21 + 13 files changed, 779 insertions(+), 73 deletions(-) create mode 100644 searchPages/find/searchAll.component.html create mode 100644 searchPages/find/searchAll.component.ts create mode 100644 searchPages/find/searchAll.module.ts diff --git a/searchPages/find/searchAll.component.html b/searchPages/find/searchAll.component.html new file mode 100644 index 00000000..35293df2 --- /dev/null +++ b/searchPages/find/searchAll.component.html @@ -0,0 +1,99 @@ +
+
+
+
+
+ + +
+
+ + + +
+ + +
+
+
+
+
+ +
+ + + + + +
+ + + + + + + + + + + diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts new file mode 100644 index 00000000..a60793b4 --- /dev/null +++ b/searchPages/find/searchAll.component.ts @@ -0,0 +1,523 @@ +import {ChangeDetectorRef, Component, Input} from '@angular/core'; +import {ChangeDetectionStrategy} from '@angular/core'; +import {ViewEncapsulation} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Location} from '@angular/common'; +import {Title, Meta} from '@angular/platform-browser'; + +import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class'; +import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class'; +import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class'; +import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class'; + +import {SearchResearchResultsService} from '../../services/searchResearchResults.service'; +import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; +import {SearchProjectsService} from '../../services/searchProjects.service'; +import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; + +import {SearchFields} from '../../utils/properties/searchFields'; +import {ErrorCodes} from '../../utils/properties/errorCodes'; +import {RouterHelper} from '../../utils/routerHelper.class'; +import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; +import {ConfigurationService} from '../../utils/configuration/configuration.service'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {SEOService} from '../../sharedComponents/SEO/SEO.service'; +import {StringUtils} from '../../utils/string-utils.class'; +import {SearchCustomFilter} from "../searchUtils/searchUtils.class"; +import {Observable} from "rxjs"; +import {AdvancedField, Filter} from "../searchUtils/searchHelperClasses.class"; + +@Component({ + changeDetection: ChangeDetectionStrategy.Default, + encapsulation: ViewEncapsulation.Emulated, + selector: 'search-all', + templateUrl: 'searchAll.component.html' +}) +export class SearchAllComponent { + public sub: any; + piwiksub: any; + // public reloadResults: boolean; + // public reloadPublications: boolean; + // public reloadDatasets: boolean; + // public reloadSoftware: boolean; + // public reloadOrps: boolean; + // public reloadProjects: boolean; + // public reloadDataproviders: boolean; + // public reloadOrganizations: boolean; + reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true}; + + public pageTitle = "Search in OpenAIRE" + public keyword: string = ""; + public publications: string[]; + public datasets: string[]; + public software: string[]; + public orps: string[]; + public projectsTab: string[]; + public dataproviders: string[]; + public organizations: string[]; + + public activeEntity = null; + public linkToSearchPublications = ""; + public linkToSearchProjects = ""; + public linkToSearchDataproviders = ""; + public linkToSearchDatasets = ""; + public linkToSearchSoftware = ""; + public linkToSearchOrps = ""; + public linkToSearchOrganizations = ""; + + public fetchPublications: FetchResearchResults; + public fetchDataproviders: FetchDataproviders; + public fetchProjects: FetchProjects; + public fetchDatasets: FetchResearchResults; + public fetchSoftware: FetchResearchResults; + public fetchOrps: FetchResearchResults; + public fetchOrganizations: FetchOrganizations; + + public searchFields: SearchFields = new SearchFields(); + public errorCodes: ErrorCodes = new ErrorCodes(); + public routerHelper: RouterHelper = new RouterHelper(); + + public publicationsSize: any = null; + public datasetsSize: any = null; + public softwareSize: any = null; + public oprsSize: any = null; + public fundersSize: any = null; + public projectsSize: any = null; + public datasourcesSize: any = null; + showPublications: boolean = false; + showDatasets: boolean = false; + showSoftware: boolean = false; + showOrps: boolean = false; + showProjects: boolean = false; + showDataProviders: boolean = false; + showOrganizations: boolean = false; + advancedSearchLink: string = "/search/advanced/publications"; + properties: EnvProperties; + @Input() logoURL; + @Input() name; + @Input() customFilter: SearchCustomFilter = null; + @Input() piwikSiteId = null; + @Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE"; + + + public subPub; + public subData; + public subSoftware; + public subOrps; + public subProjects; + public subOrg; + public subDataPr; + + + quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { + filter: null, + selected: true, + filterId: "resultbestaccessright", + value: "Open Access" + }; + + resultTypes = {publication: true, dataset: true, software: true, other: true}; + + //adv Search Form + public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS; + public fieldIdsMap = this.searchFields.RESULT_FIELDS; + public selectedFields: AdvancedField[] = []; + + //new + parameters = {}; + disableForms: boolean = true; + + constructor(private route: ActivatedRoute, + private _router: Router, + private _searchResearchResultsService: SearchResearchResultsService, + private _searchDataprovidersService: SearchDataprovidersService, + private _searchProjectsService: SearchProjectsService, + private _searchOrganizationsService: SearchOrganizationsService, + private _refineFieldResultsService: RefineFieldResultsService, + private location: Location, + private _meta: Meta, + private _title: Title, + private _piwikService: PiwikService, + private config: ConfigurationService, + private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) { + this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService); + this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); + this.fetchProjects = new FetchProjects(this._searchProjectsService); + this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService); + this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService); + this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService); + this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService); + this.selectedFields.push(new AdvancedField(this.fieldIds[0], this.fieldIdsMap[this.fieldIds[0]].param, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, '', "and")); + + } + + public ngOnInit() { + this.route.data + .subscribe((data: { envSpecific: EnvProperties }) => { + + var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; + var title = "OpenAIRE | Search publications, research data, projects... | OpenAIRE"; + this.properties = data.envSpecific; + var url = data.envSpecific.baseLink + this._router.url; + this._title.setTitle(title); + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + this._meta.updateTag({content: title}, "property='og:title'"); + this._meta.updateTag({content: url}, "property='og:url'"); + this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false); + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE |Search publications, research data, projects...", this.piwikSiteId).subscribe(); + + } + + + if ((this.customFilter && this.customFilter.queryFieldName == "communitId") || this.properties.adminToolsCommunity) { + this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communitId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => { + var showEntity = {}; + for (var i = 0; i < data['entities'].length; i++) { + + showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; + } + this.showPublications = showEntity["publication"]; + this.showDatasets = showEntity["dataset"]; + this.showProjects = showEntity["project"]; + this.showOrganizations = showEntity["organization"]; + this.showDataProviders = showEntity["datasource"]; + this.showSoftware = showEntity["software"]; + this.showOrps = showEntity["orp"]; + if (this.customFilter && this.customFilter.queryFieldName == "communityId") { + this.showProjects = false; + this.showOrganizations = false; + this.showDataProviders = false; + } + this.loadAll(); + + }); + } else { + if ((this.customFilter && this.customFilter.queryFieldName == "country")) { + this.showPublications = true; + this.showDatasets = true; + this.showDataProviders = true; + this.showSoftware = true; + this.showOrps = true; + this.showProjects = true; + this.showOrganizations = true; + this.showDataProviders = true; + } + } + this.loadAll(); + }); + } + + loadAll() { + this.reloadTabs(); + this.sub = this.route.queryParams.subscribe(params => { + this.parameters = Object.assign({}, params); + this.keyword = (params['keyword']) ? params['keyword'] : (params["q"] ? params["q"] : ""); + this.selectedFields[0].value = this.keyword; + this.quickFilter.selected = ((params['qf']== undefined || params["qf"] == "true") == true); + if (params["type"] && params["type"].length > 0) { + this.resultTypes['publication'] = (params["type"].split(",").indexOf("publications") != -1); + this.resultTypes['dataset'] = (params["type"].split(",").indexOf("datasets") != -1); + this.resultTypes['software'] = (params["type"].split(",").indexOf("software") != -1); + this.resultTypes['other'] = (params["type"].split(",").indexOf("other") != -1); + } + if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){ + this.activeEntity = this.getDefaultEntityToShow(); + }else if(params["active"] && params["active"].length >0 ){ + this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow(); + }else if (this.activeEntity !=null && (!params["active"] || params["active"].length ==0)){ + this.parameters["active"]=this.activeEntity; + if(location.search && location.search.indexOf("active=") == -1){ + this.location.go(location.pathname, ((location.search)?(location.search+"&"):("?")) +"active=" + this.activeEntity); + } + } + if (this.activeEntity == "result") { + this.searchResults(); + } else if (this.activeEntity == "projects") { + this.searchProjects(); + } else if (this.activeEntity == "datasources") { + this.searchDataProviders(); + } else if (this.activeEntity == "organizations") { + this.searchOrganizations(); + } + this.count(); + }); + } + + getDefaultEntityToShow(){ + if (this.showPublications || this.showDatasets || this.showSoftware || this.showOrps) { + return "result"; + } else if (this.showProjects) { + return "projects"; + } else if (this.showDataProviders) { + return "content providers"; + } else if (this.showOrganizations) { + return "organizations"; + } + } + + public ngOnDestroy() { + if (this.sub) { + this.sub.unsubscribe(); + } + if (this.piwiksub) { + this.piwiksub.unsubscribe(); + } + if (this.keyword != null && this.keyword.length > 0) { + if (this.subPub) { + this.subPub.unsubscribe(); + } + if (this.subData) { + this.subData.unsubscribe(); + } + if (this.subSoftware) { + this.subSoftware.unsubscribe(); + } + if (this.subOrps) { + this.subOrps.unsubscribe(); + } + if (this.subProjects) { + this.subProjects.unsubscribe(); + } + if (this.subOrg) { + this.subOrg.unsubscribe(); + } + if (this.subDataPr) { + this.subDataPr.unsubscribe(); + } + + } + } + + public searchResults() { + this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications"; + if (this.reload[this.activeEntity] && + this.fetchPublications.searchUtils.status != this.errorCodes.NONE) { + this.reload[this.activeEntity] = false; + this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; + } + } + + + public searchProjects() { + this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects"; + if (this.reload[this.activeEntity] && + this.fetchProjects.searchUtils.status != this.errorCodes.NONE ) { + this.reload[this.activeEntity] = false; + this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword; + } + } + + public searchDataProviders() { + this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders"; + if ( this.reload[this.activeEntity] && + this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE) { + this.reload[this.activeEntity] = false; + this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword; + } + } + + public searchOrganizations() { + this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations"; + if (this.reload[this.activeEntity] && + this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE) { + this.reload[this.activeEntity] = false; + this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword; + } + } + private prepareKeywordParam(keyword){ + if (this.parameters["q"] && keyword.length == 0) { + delete this.parameters['q']; + delete this.parameters['op']; + } else { + this.parameters["q"] = keyword; + this.parameters["op"] = "and"; + } + } + private prepareResultParameters() { + //quickSelections + if (this.resultTypes && this.activeEntity == "result") { + let values = []; + if (this.resultTypes.publication) { + values.push("publications"); + } + if (this.resultTypes.dataset) { + values.push("datasets"); + } + if (this.resultTypes.software) { + values.push("software"); + } + if (this.resultTypes.other) { + values.push("other"); + } + if (values.length > 0) { + this.parameters["type"] = values.join(","); + } + } + if (this.quickFilter && this.activeEntity == "result") { + this.parameters["qf"] = this.quickFilter.selected; + } + } + + public quickSelectionsChanged() { + this.prepareResultParameters(); + this.reload[this.activeEntity] = true; + this.router.navigate([location.pathname], {queryParams: this.parameters}); + } + + + public keywordChanged($event) { + this.prepareKeywordParam(this.selectedFields[0].value); + this.reloadTabs(); + this.router.navigate([location.pathname], {queryParams: this.parameters}); + } + + private count() { + var refineParams = null; + if (this.customFilter) { + refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); + } + if (this.activeEntity != "result" && this.reload["result"] && (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) { + this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; + this.reload["result"] = false; + this.fetchPublications.results = []; + this.subPub = this.numOfSearchResults(this.fetchPublications, refineParams); + } + + if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) { + this.fetchProjects.searchUtils.status = this.errorCodes.LOADING; + this.fetchProjects.results = []; + this.reload["projects"] = false; + this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword, this.properties, refineParams).subscribe( + data => { + this.fetchProjects.searchUtils.totalResults = data; + this.fetchProjects.searchUtils.status = this.errorCodes.DONE; + if (this.fetchProjects.searchUtils.totalResults == 0) { + this.fetchProjects.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + //console.log(err); + this.handleError("Error getting number of Projects", err); + this.fetchProjects.searchUtils.status = this.errorCodes.ERROR; + } + ); + } + if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) { + this.fetchDataproviders.results = []; + this.reload["datasources"] = false; + this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams); + } + if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) { + this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING; + this.fetchOrganizations.results = []; + this.reload["organizations"] = false; + this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword, this.properties, refineParams).subscribe( + data => { + this.fetchOrganizations.searchUtils.totalResults = data; + this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE; + if (this.fetchOrganizations.searchUtils.totalResults == 0) { + this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + //console.log(err); + this.handleError("Error getting number of Organizations", err); + this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR; + + } + ); + } + + + } + + private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Observable { + return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword, this.properties, refineParams).subscribe( + data => { + fetchClass.searchUtils.totalResults = data; + fetchClass.searchUtils.status = this.errorCodes.DONE; + if (fetchClass.searchUtils.totalResults == 0) { + fetchClass.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + this.handleError("Error getting number of research results", err); + fetchClass.searchUtils.status = this.errorCodes.ERROR; + } + ); + } + + private reloadTabs() { + this.reload = {result:true, projects:true, datasources: true, organizations:true}; + this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING; + this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING; + this.fetchProjects.searchUtils.status = this.errorCodes.LOADING; + this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; + this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING; + this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING; + this.fetchOrps.searchUtils.status = this.errorCodes.LOADING; + } + + private handleError(message: string, error) { + console.error("General Search Page: " + message, error); + } + + private getEntityName(entityType: string, plural: boolean, full: boolean): string { + if (entityType == "publication") { + return "publication" + (plural ? "s" : ""); + } else if (entityType == "dataset") { + return (full ? "research data" : ("dataset" + (plural ? "s" : ""))); + } else if (entityType == "software") { + return "software"; + } else if (entityType == "other") { + return (full ? ("other research product" + (plural ? "s" : "")) : "other"); + } + } + + activeEntityUpdate($event) { + this.disableForms = $event.disableForms; + let updated = true; + if (this.activeEntity == "result") { + if($event.searchUtils.status!=this.errorCodes.LOADING) { + this.fetchPublications.searchUtils.totalResults = $event.searchUtils.totalResults; + } + this.fetchPublications.searchUtils.status = $event.searchUtils.status; + }else if (this.activeEntity == "projects"){ + if($event.searchUtils.status!=this.errorCodes.LOADING) { + this.fetchProjects.searchUtils.totalResults = $event.searchUtils.totalResults; + } + this.fetchProjects.searchUtils.status = $event.searchUtils.status; + }else if (this.activeEntity == "datasources"){ + if($event.searchUtils.status!=this.errorCodes.LOADING) { + this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults; + } + this.fetchDataproviders.searchUtils.status = $event.searchUtils.status; + }else if (this.activeEntity == "organizations") { + if($event.searchUtils.status!=this.errorCodes.LOADING) { + this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults; + } + this.fetchOrganizations.searchUtils.status = $event.searchUtils.status; + }else{ + updated = false; + } + if(updated) { + this.cdr.detectChanges(); + } + } + + entityChanged(entity){ + this.activeEntity = entity; + this.parameters = {}; + this.reload[entity]= true; + this.parameters["active"] = entity; + if ( this.keyword.length > 0) { + this.parameters["q"] = this.keyword; + this.parameters["op"] = "and"; + } + this.router.navigate([location.pathname], {queryParams: this.parameters}); + } + +} diff --git a/searchPages/find/searchAll.module.ts b/searchPages/find/searchAll.module.ts new file mode 100644 index 00000000..76d1dd7e --- /dev/null +++ b/searchPages/find/searchAll.module.ts @@ -0,0 +1,43 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + + +import {SearchResultsModule } from '../searchUtils/searchResults.module'; + +import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; +import {ProjectsServiceModule} from '../../services/projectsService.module'; +import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module'; +import {OrganizationsServiceModule} from '../../services/organizationsService.module'; +import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module'; +import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; + +import {PiwikServiceModule} from '../../utils/piwik/piwikService.module'; +import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; +import {SearchAllComponent} from "./searchAll.component"; +import {AdvancedSearchFormModule} from "../searchUtils/advancedSearchForm.module"; +import {SearchResearchResultsModule} from "../searchResearchResults.module"; +import {QuickSelectionsModule} from "../searchUtils/quick-selections.module"; +import {SearchProjectsModule} from "../searchProjects.module"; +import {SearchOrganizationsModule} from "../searchOrganizations.module"; +import {SearchDataProvidersModule} from "../searchDataProviders.module"; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + DataProvidersServiceModule, ProjectsServiceModule, + SearchResearchResultsServiceModule, OrganizationsServiceModule, + BrowseEntitiesModule, SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule, QuickSelectionsModule, SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule + ], + declarations: [ + SearchAllComponent + ], + providers:[ + //FreeGuard, PreviousRouteRecorder + ], + exports: [ + SearchAllComponent + ] +}) +export class SearchAllModule { } diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 60ae12f0..85a46031 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {AdvancedField} from './searchUtils/searchHelperClasses.class'; import {SearchDataprovidersService} from '../services/searchDataproviders.service'; @@ -19,19 +19,20 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'content providers' | titlecase }}" entityType="content provider" type="content providers" - [(results)]="results" - [(searchUtils)]="searchUtils" - [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" + [results]="results" + [searchUtils]="searchUtils" + [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="projects" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [(openaireLink)]=openaireLink + [openaireLink]=openaireLink + [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" searchFormClass="datasourcesSearchForm" - [(filters)]="filters" + [filters]="filters" [simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..." > @@ -65,10 +66,12 @@ export class SearchDataProvidersComponent { public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS; @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; - simpleSearchLink: string = ""; + @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; @Input() hasPrefix: boolean = true; @Input() openaireLink: string; + @Input() includeOnlyResultsAndFilter: boolean = false; + @Output() searchPageUpdates = new EventEmitter(); constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) { this.results =[]; this.errorCodes = new ErrorCodes(); @@ -82,8 +85,9 @@ export class SearchDataProvidersComponent { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties= data.envSpecific; - this.simpleSearchLink = this.properties.searchLinkToDataProviders; - this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders; + if (!this.simpleSearchLink) { + this.simpleSearchLink = this.properties.searchLinkToProjects; + } this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; this.pagingLimit = data.envSpecific.pagingLimit; this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; @@ -141,6 +145,8 @@ export class SearchDataProvidersComponent { this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.results = []; this.searchUtils.totalResults = 0; @@ -162,6 +168,7 @@ export class SearchDataProvidersComponent { } //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit @@ -195,6 +202,8 @@ export class SearchDataProvidersComponent { }*/ //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + } ); } diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index c348f09d..31e3c56b 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {AdvancedField} from './searchUtils/searchHelperClasses.class'; import {SearchOrganizationsService} from '../services/searchOrganizations.service'; @@ -17,18 +17,20 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'organizations' | titlecase }}" entityType="organization" type="organizations" - [(results)]="results" - [(searchUtils)]="searchUtils" - [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" + [results]="results" + [searchUtils]="searchUtils" + [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="organizations" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [(openaireLink)]=openaireLink + [openaireLink]=openaireLink [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" searchFormClass="organizationSearchForm" - [(filters)]="filters" + [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" + + [filters]="filters" [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..." > @@ -59,11 +61,12 @@ export class SearchOrganizationsComponent { public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS; @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; - simpleSearchLink: string = ""; + @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; @Input() hasPrefix: boolean = true; @Input() openaireLink: string; - + @Input() includeOnlyResultsAndFilter: boolean = false; + @Output() searchPageUpdates = new EventEmitter(); public resourcesQuery = "(oaftype exact organization)"; constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) { this.results =[]; @@ -78,8 +81,9 @@ public resourcesQuery = "(oaftype exact organization)"; this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties= data.envSpecific; - this.simpleSearchLink = this.properties.searchLinkToProjects; - this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects; + if (!this.simpleSearchLink) { + this.simpleSearchLink = this.properties.searchLinkToProjects; + } this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; this.pagingLimit = data.envSpecific.pagingLimit; this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; @@ -139,6 +143,8 @@ public resourcesQuery = "(oaftype exact organization)"; this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.results = []; this.searchUtils.totalResults = 0; @@ -160,8 +166,9 @@ public resourcesQuery = "(oaftype exact organization)"; } //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); - if(this.searchUtils.status == this.errorCodes.DONE) { + if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit!!! let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); if(!(Number.isInteger(totalPages))) { @@ -194,6 +201,8 @@ public resourcesQuery = "(oaftype exact organization)"; //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + } ); } diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index d52ca5ea..af6f401f 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {AdvancedField} from './searchUtils/searchHelperClasses.class'; import {SearchProjectsService} from '../services/searchProjects.service'; @@ -17,18 +17,19 @@ import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'projects' | titlecase }}" entityType="project" type="projects" - [(results)]="results" - [(searchUtils)]="searchUtils" - [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" + [results]="results" + [searchUtils]="searchUtils" + [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="projects" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [(openaireLink)]=openaireLink + [openaireLink]=openaireLink [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" searchFormClass="projectSearchForm" - [(filters)]="filters" + [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" + [filters]="filters" [rangeFilters]="rangeFilters" [rangeFields]="rangeFields" [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..." > @@ -65,11 +66,12 @@ export class SearchProjectsComponent { public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS; @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; - simpleSearchLink: string = ""; + @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; @Input() hasPrefix: boolean = true; @Input() openaireLink: string; - + @Input() includeOnlyResultsAndFilter: boolean = false; + @Output() searchPageUpdates = new EventEmitter(); constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) { this.results =[]; @@ -85,7 +87,9 @@ export class SearchProjectsComponent { this.route.data .subscribe((data: { envSpecific: EnvProperties }) => { this.properties= data.envSpecific; - this.simpleSearchLink = this.properties.searchLinkToProjects; + if (!this.simpleSearchLink) { + this.simpleSearchLink = this.properties.searchLinkToProjects; + } this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; this.pagingLimit = data.envSpecific.pagingLimit; @@ -118,11 +122,6 @@ export class SearchProjectsComponent { this.searchPage.fieldIds = this.fieldIds; this.selectedFields = []; this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project"); - // this.selectedFields =[]; - // this.searchPage.selectedFields = this.selectedFields; - // this.searchPage.fieldIdsMap = this.fieldIdsMap; - // this.searchPage.customFilter = this.customFilter; - // this.searchPage.getSelectedFiltersFromUrl(params); this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; }); @@ -147,6 +146,7 @@ export class SearchProjectsComponent { this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; @@ -170,6 +170,7 @@ export class SearchProjectsComponent { } //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit!!! @@ -204,6 +205,7 @@ export class SearchProjectsComponent { //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) } ); diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 9d60a71e..ea08f820 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class'; import {SearchResearchResultsService} from '../services/searchResearchResults.service'; @@ -18,31 +18,32 @@ import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ getEntityName(resultType, true, true) | titlecase }}" [entityType]="resultType" [type]="getEntityName(resultType, true, true)" - [(results)]="results" - [(searchUtils)]="searchUtils" - [(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" + [results]="results" + [searchUtils]="searchUtils" + [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" - [(openaireLink)]=openaireLink + [openaireLink]=openaireLink [piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix" searchFormClass="publicationsSearchForm" - [(sort)]=sort - [(filters)]="filters" [quickFilter]="quickFilter" + [sort]=sort + [filters]="filters" [quickFilter]="quickFilter" [rangeFilters]="rangeFilters" [rangeFields]="rangeFields" [simpleView]="simpleView" formPlaceholderText="Search by title, author, doi, abstract content..." + [includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" > - + ` }) export class SearchResearchResultsComponent { @Input() resultType: string = "result"; - simpleSearchLink: string = ""; + @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; private errorCodes: ErrorCodes; @@ -80,13 +81,15 @@ export class SearchResearchResultsComponent { filterId: "resultbestaccessright", value: "Open Access" }; + @Input() includeOnlyResultsAndFilter: boolean = false; + @Output() searchPageUpdates = new EventEmitter(); constructor(private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService) { this.results = []; this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.searchUtils.status = this.errorCodes.LOADING; - } + } ngOnInit() { console.log(this.quickFilter); @@ -96,10 +99,11 @@ export class SearchResearchResultsComponent { this.pagingLimit = data.envSpecific.pagingLimit; this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; - - this.simpleSearchLink = this.properties.searchLinkToResults; + if (!this.simpleSearchLink) { + this.simpleSearchLink = this.properties.searchLinkToResults; + } this.advancedSearchLink = this.properties.searchLinkToAdvancedResults; - this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; + this.searchUtils.baseUrl = (this.simpleView) ? this.simpleSearchLink : this.advancedSearchLink; }); @@ -128,18 +132,9 @@ export class SearchResearchResultsComponent { } this.selectedFields = []; -// <<<<<<< .mine this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter); this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); -// ||||||| .r58066 -// this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params); -// this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params)); -// ======= -// this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter); -// this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); -// firstLoad = false; -// -// >>>>>>> .r58095 + firstLoad = false; }); } @@ -159,10 +154,11 @@ export class SearchResearchResultsComponent { } else { this.csvParams = "&fq=" + this.resourcesQuery; } - this.csvParams += (refineFieldsFilterQuery?refineFieldsFilterQuery:''); + this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : ''); this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( @@ -172,7 +168,7 @@ export class SearchResearchResultsComponent { if (refine) { this.filters = this.searchPage.prepareFiltersToShow(data[2]); - }else{ + } else { this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); } this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); @@ -182,6 +178,7 @@ export class SearchResearchResultsComponent { this.searchUtils.status = this.errorCodes.NONE; } this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) if (this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit!!! @@ -215,6 +212,7 @@ export class SearchResearchResultsComponent { //this.searchPage.closeLoading(); this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) } ); diff --git a/searchPages/searchUtils/advancedSearchForm.component.html b/searchPages/searchUtils/advancedSearchForm.component.html index 8999fa5d..7838f18e 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.html +++ b/searchPages/searchUtils/advancedSearchForm.component.html @@ -141,11 +141,11 @@ Search
- Advanced search - Advanced search diff --git a/searchPages/searchUtils/advancedSearchForm.component.ts b/searchPages/searchUtils/advancedSearchForm.component.ts index 3de91cd1..1776a399 100644 --- a/searchPages/searchUtils/advancedSearchForm.component.ts +++ b/searchPages/searchUtils/advancedSearchForm.component.ts @@ -24,7 +24,7 @@ export class AdvancedSearchFormComponent { @Input() formPlaceholderText = "Type Keywords..."; @Input() pageTitle; @Output() queryChange = new EventEmitter(); - @Input() @Output() resultTypes; + @Input()resultTypes; @Input() quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string}; validDateFrom: boolean = true; validDateTo: boolean = true; diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index 695033ac..9f687004 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -87,7 +87,7 @@ export class EntitiesSelectionComponent { getUrl(simpleView:boolean){ let url = ""; if(this.selectedEntity == "all"){ - url = "/search/find/"; + url = (simpleView?"/search/find/":null); }else if(this.selectedEntity == "result"){ url = (simpleView?this.properties.searchLinkToResults:this.properties.searchLinkToAdvancedResults); }else if(this.selectedEntity == "project"){ diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 5fad1d7b..37c52cdc 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -1,5 +1,6 @@ -
+
@@ -7,9 +8,9 @@
@@ -25,7 +26,8 @@
- + @@ -144,7 +146,7 @@
-
+
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 55e756eb..aee7f68c 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -66,9 +66,9 @@ export class NewSearchPageComponent { @Input() keywordFields = []; @Input() simpleView: boolean = true; @Input() formPlaceholderText = "Type Keywords..."; - @Input() @Output() resultTypes = null; - @Input() @Output() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string }; - + @Input() resultTypes = null; + @Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string }; + @Input() includeOnlyResultsAndFilter:boolean = false; piwiksub: any; public parameterNames: string[] = []; public parameterValues: string[] = []; diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 0c3c37cc..23c0358c 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -378,7 +378,28 @@ export class SearchResearchResultsService { let url = properties.searchAPIURLLAst+parameters+"?format=json"; return this.numOfResults(url , properties); } + numOfResearchOutcomes( params: string, properties:EnvProperties, refineParams:string=null):any { + let url = properties.searchAPIURLLAst+"resources2/?format=json&size=0&type=publications&type=datasets&type=software&type=other"; + if(params.length > 0){ + var DOIs:string[] = DOI.getDOIsFromString(params); + var doisParams = ""; + for(var i =0 ;i < DOIs.length; i++){ + doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"'; + } + if(doisParams.length > 0){ + url += "&"+doisParams; + }else{ + url += "&q=" + StringUtils.URIEncode(params); + } + } + + if(refineParams!= null && refineParams != '' ) { + url += refineParams; + } + return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + .pipe(map(res => res['meta']['total'])); + } numOfSearchResults(resultType:string, params: string, properties:EnvProperties, refineParams:string=null):any { let url = properties.searchAPIURLLAst+this.getEntityName(resultType, true)+"/count?format=json"; if(params.length > 0){