[Trunk | Library]:

Merge services, fetchClasses, simple and advanced search pages for research results (publications, datasets, software, other):

1. advancedSearchResearchResults.component & advancedSearchResearchResults.module: New common advanced search page for research results.
2. searchResearchResults.component & searchResearchResults.module: New common simple search page for research results.
3. fetchResearchResults.class: New common fetch class for research results.
4. searchResearchResults.service: Update existing service to satisfy merge of research results services.
5. app.module.ts: Import one common simple and one common advanced search page for search results.
6. claimResultSearchForm & directLinking &
        advancedSearchDatasets & advancedSearchOrps & advancedSearchPublications & advancedSearchSoftware &
        searchDatasets & searchOrps & searchPublications & searchSoftware &
        fetchDatasets.class & fetchOrps.class & fetchPublications.class & fetchSoftware.class: Use common service for research results (searchResearchResults.service).
7. datasetsTab & orpsTab & publicationsTab & softwareTab & relatedDatasourcesTab & statisticsTab:  Use common fetch class for research results (fetchResearchResults.class).
8. dataProvider & organization & project & search : Use common service and common fetch class for research results (searchResearchResults.service, fetchResearchResults.class).
9. linkingGeneric.component: Remove import of services for publications and datasets.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57027 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-09-11 09:45:54 +00:00
parent 871e0559ba
commit cde4550dfc
47 changed files with 1115 additions and 401 deletions

View File

@ -26,18 +26,12 @@ import {DepositBySubjectResultsModule} from './deposit/datasets/depositBySubject
import {DepositPublicationsModule} from './deposit/publications/depositPublications.module';
import {DepositPublicationsResultsModule} from './deposit/publications/depositPublicationsResults.module';
import {SearchPublicationsModule} from './searchPages/simple/searchPublications.module';
import {SearchDatasetsModule} from './searchPages/simple/searchDatasets.module';
import {SearchSoftwareModule} from './searchPages/simple/searchSoftware.module';
import {SearchOrpsModule} from './searchPages/simple/searchOrps.module';
import {SearchResearchResultsModule} from './searchPages/simple/searchResearchResults.module';
import {SearchDataProvidersModule} from './searchPages/simple/searchDataProviders.module';
import {SearchProjectsModule} from './searchPages/simple/searchProjects.module';
import {SearchOrganizationsModule} from './searchPages/simple/searchOrganizations.module';
import {AdvancedSearchPublicationsModule} from './searchPages/advanced/advancedSearchPublications.module';
import {AdvancedSearchDatasetsModule} from './searchPages/advanced/advancedSearchDatasets.module';
import {AdvancedSearchSoftwareModule} from './searchPages/advanced/advancedSearchSoftware.module';
import {AdvancedSearchOrpsModule} from './searchPages/advanced/advancedSearchOrps.module';
import {AdvancedSearchResearchResultsModule} from './searchPages/advanced/advancedSearchResearchResults.module';
import {AdvancedSearchDataProvidersModule} from './searchPages/advanced/advancedSearchDataProviders.module';
import {AdvancedSearchProjectsModule} from './searchPages/advanced/advancedSearchProjects.module';
import {AdvancedSearchOrganizationsModule} from './searchPages/advanced/advancedSearchOrganizations.module';
@ -74,8 +68,8 @@ import { AppRoutingModule } from './app-routing.module';
MainSearchModule,
ErrorModule,
DepositDatasetsModule,DepositDatasetsResultsModule, DepositBySubjectResultsModule,DepositPublicationsModule , DepositPublicationsResultsModule,
SearchPublicationsModule,SearchDatasetsModule, SearchSoftwareModule, SearchOrpsModule, SearchDataProvidersModule, SearchProjectsModule, SearchOrganizationsModule,
AdvancedSearchPublicationsModule,AdvancedSearchDatasetsModule, AdvancedSearchSoftwareModule, AdvancedSearchOrpsModule, AdvancedSearchDataProvidersModule, AdvancedSearchProjectsModule, AdvancedSearchOrganizationsModule,
SearchResearchResultsModule, SearchDataProvidersModule, SearchProjectsModule, SearchOrganizationsModule,
AdvancedSearchResearchResultsModule, AdvancedSearchDataProvidersModule, AdvancedSearchProjectsModule, AdvancedSearchOrganizationsModule,
ResultLandingModule, DataProviderModule, OrganizationModule, ProjectModule,
EntityRegistriesModule, CompatibleDataProvidersModule, JournalsModule,
JournalsTableModule, EntityRegistriesTableModule, CompatibleDataProvidersTableModule,

View File

@ -1,12 +1,8 @@
import {Component, Input} from '@angular/core';
import {SearchCrossrefService} from './service/searchCrossref.service';
import {SearchOrcidService} from './service/searchOrcid.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {SearchDataciteService} from './service/searchDatacite.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ClaimEntity, ClaimResult} from './claimHelper.class';
import {DOI, StringUtils} from '../../utils/string-utils.class';
@ -95,9 +91,10 @@ export class ClaimResultSearchFormComponent {
reloadDatacite: boolean = false;
reloadOrcid: boolean = false;
constructor(private _searchDataciteService: SearchDataciteService, private _searchDatasetsService: SearchDatasetsService, private _searchSoftwareService: SearchSoftwareService,
private _searchCrossrefService: SearchCrossrefService, private _searchOrcidService: SearchOrcidService, private _searchPublicationsService: SearchPublicationsService,
private _searchORPService: SearchOrpsService) {
constructor(private _searchDataciteService: SearchDataciteService,
private _searchCrossrefService: SearchCrossrefService,
private _searchOrcidService: SearchOrcidService,
private _searchResearchResultsService: SearchResearchResultsService) {
const myDate = new Date();
this.todayDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
this.nextDate = (myDate.getFullYear() + 100) + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
@ -274,7 +271,7 @@ export class ClaimResultSearchFormComponent {
this.totalOpenaireCount = 0;
}
if (type == "dataset") {
this._searchDatasetsService.searchDatasets(this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
this._searchResearchResultsService.search("dataset", this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
data => {
this.setOpenaireResults(data, mainResults, page, type);
},
@ -283,7 +280,7 @@ export class ClaimResultSearchFormComponent {
}
);
} else if (type == "software") {
this._searchSoftwareService.searchSoftware(this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
this._searchResearchResultsService.search("software", this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
data => {
this.setOpenaireResults(data, mainResults, page, type);
},
@ -292,7 +289,7 @@ export class ClaimResultSearchFormComponent {
}
);
} else if (type == "other") {
this._searchORPService.searchOrps(this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
this._searchResearchResultsService.search("other", this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
data => {
this.setOpenaireResults(data, mainResults, page, type);
},
@ -301,7 +298,7 @@ export class ClaimResultSearchFormComponent {
}
);
} else {
this._searchPublicationsService.searchPublications(this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
this._searchResearchResultsService.search("publication", this.createOpenaireQueryParams(), (mainResults && page==1 ?this.openaireRefineFieldsQuery:null), (mainResults?page:1), (mainResults?size:0), "", (mainResults && page==1 ?this.openaireRefineFields:[]), this.properties).subscribe(
data => {
this.setOpenaireResults(data, mainResults, page, type);
},

View File

@ -10,17 +10,14 @@ import {SearchDataciteServiceModule} from './service/searchDataciteService.modul
import {SearchCrossrefServiceModule} from './service/searchCrossrefService.module';
import {SearchOrcidService} from './service/searchOrcid.service';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {PagingModule } from '../../utils/paging.module';
import {HelperModule} from '../../utils/helper/helper.module';
import {SearchFilterModule} from '../../searchPages/searchUtils/searchFilter.module';
@NgModule({
imports: [SharedModule, CommonModule, PublicationsServiceModule, DatasetsServiceModule, PagingModule, SearchCrossrefServiceModule,
SearchDataciteServiceModule,SoftwareServiceModule, OrpsServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule],
imports: [SharedModule, CommonModule, SearchResearchResultsServiceModule, PagingModule, SearchCrossrefServiceModule,
SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule],
providers:[
SearchOrcidService
],

View File

@ -5,10 +5,7 @@ import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ClaimEntity, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {LinkingGenericComponent} from "../linking/linkingGeneric.component";
import {ClaimResultSearchFormComponent} from "../claim-utils/claimResultSearchForm.component";
@ -40,9 +37,7 @@ export class DirectLinkingComponent {
@Input() communityId: string = null;
localStoragePrefix: string = "";
constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService,
private publicationsSearch: SearchPublicationsService, private datasetsSearch: SearchDatasetsService,
private softwareSearch: SearchSoftwareService, private ORPSearch: SearchOrpsService) {
}
private _searchResearchResultsService: SearchResearchResultsService) {}
ngOnInit() {
this.route.data
@ -140,7 +135,7 @@ export class DirectLinkingComponent {
getPublicationById(id: string) {
this.sub = this.publicationsSearch.searchPublicationById(id, this.properties).subscribe(data => {
this.sub = this._searchResearchResultsService.searchById("publication", id, this.properties).subscribe(data => {
this.createClaimEntity(data, "publication");
},
err => {
@ -151,7 +146,7 @@ export class DirectLinkingComponent {
}
getDatasetById(id: string) {
this.sub = this.datasetsSearch.searchDatasetById(id, this.properties).subscribe(
this.sub = this._searchResearchResultsService.searchById("dataset", id, this.properties).subscribe(
data => {
this.createClaimEntity(data, "dataset");
},
@ -163,7 +158,7 @@ export class DirectLinkingComponent {
}
getSoftwareById(id: string) {
this.sub = this.softwareSearch.searchSoftwareById(id, this.properties).subscribe(
this.sub = this._searchResearchResultsService.searchById("software", id, this.properties).subscribe(
data => {
this.createClaimEntity(data, "software");
},
@ -175,7 +170,7 @@ export class DirectLinkingComponent {
}
getOrpById(id: string) {
this.sub = this.ORPSearch.searchOrpById(id, this.properties).subscribe(
this.sub = this._searchResearchResultsService.searchById("other", id, this.properties).subscribe(
data => {
this.createClaimEntity(data, "other");
},

View File

@ -4,13 +4,10 @@ import { SharedModule } from '../../shared/shared.module';
import { DirectLinkingComponent } from './directLinking.component';
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {LinkingGenericModule} from '../linking/linkingGeneric.module';
@ -18,8 +15,8 @@ import {LinkingGenericModule} from '../linking/linkingGeneric.module';
@NgModule({
imports: [
SharedModule,
EntitySearchServiceModule, PublicationsServiceModule, DatasetsServiceModule, SoftwareServiceModule,
OrpsServiceModule, Schema2jsonldModule, SEOServiceModule, LinkingGenericModule
EntitySearchServiceModule, SearchResearchResultsServiceModule,
Schema2jsonldModule, SEOServiceModule, LinkingGenericModule
],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [

View File

@ -4,8 +4,6 @@ import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ClaimEntity, ShowOptions} from '../claim-utils/claimHelper.class';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SEOService} from '../../sharedComponents/SEO/SEO.service';
import {AlertModal} from "../../utils/modal/alert";
import {HelperFunctions} from "../../utils/HelperFunctions.class";
@ -47,7 +45,6 @@ export class LinkingGenericComponent {
constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private publicationsSearch:SearchPublicationsService, private datasetsSearch:SearchDatasetsService,
private _meta: Meta, private _title: Title, private _piwikService:PiwikService,
private seoService: SEOService, private helper: HelperService ) {
}

View File

@ -8,14 +8,8 @@ import {EnvProperties} from '../../utils/properties/env-properties';
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
import {DataProviderService} from './dataProvider.service';
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
@ -64,16 +58,16 @@ export class DataProviderComponent {
public pubsProjectsUrl: string;
// Variables for publications, research data, projects, content providers, related content providers tabs
public fetchPublications: FetchPublications;
public fetchDatasets: FetchDatasets;
public fetchSoftware: FetchSoftware;
public fetchOrps: FetchOrps;
public fetchPublications: FetchResearchResults;
public fetchDatasets: FetchResearchResults;
public fetchSoftware: FetchResearchResults;
public fetchOrps: FetchResearchResults;
public fetchProjects: FetchProjects;
public fetchDataproviders: FetchDataproviders;
public fetchAggregatorsPublications: FetchPublications;
public fetchAggregatorsDatasets: FetchDatasets;
public fetchAggregatorsSoftware: FetchSoftware;
public fetchAggregatorsOrps: FetchOrps;
public fetchAggregatorsPublications: FetchResearchResults;
public fetchAggregatorsDatasets: FetchResearchResults;
public fetchAggregatorsSoftware: FetchResearchResults;
public fetchAggregatorsOrps: FetchResearchResults;
public loadingRelatedDatasources: boolean = true;
@ -107,18 +101,15 @@ export class DataProviderComponent {
private _meta: Meta,
private _title: Title,
private _router: Router,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService,
private _searchSoftwareService: SearchSoftwareService,
private _searchOrpsService: SearchOrpsService,
private _searchResearchResultsService: SearchResearchResultsService,
private _searchProjectsService: SearchProjectsService,
private _searchDataprovidersService: SearchDataprovidersService,
private seoService: SEOService,
private helper: HelperService) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
this.fetchOrps = new FetchOrps(this._searchOrpsService);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -285,13 +276,13 @@ export class DataProviderComponent {
// return tab.name === 'Publications';
//})) {
// this.relatedDataprovidersResultsType = 'publications';
this.fetchAggregatorsPublications = new FetchPublications(this._searchPublicationsService);
this.fetchAggregatorsPublications = new FetchResearchResults(this._searchResearchResultsService);
//} else {
// this.relatedDataprovidersResultsType = 'datasets';
this.fetchAggregatorsDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchAggregatorsDatasets = new FetchResearchResults(this._searchResearchResultsService);
//}
this.fetchAggregatorsSoftware = new FetchSoftware(this._searchSoftwareService);
this.fetchAggregatorsOrps = new FetchOrps(this._searchOrpsService);
this.fetchAggregatorsSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchAggregatorsOrps = new FetchResearchResults(this._searchResearchResultsService);
}
if (this.dataProviderInfo.resultsBy == "collectedFrom") {
//this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and";
@ -351,52 +342,52 @@ export class DataProviderComponent {
if (this.reloadPublications &&
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE)) {
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchPublications.getResultsForDataproviders("publication", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadPublications = false;
}
private countPublications(page: number, size: number) {
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchPublications.getResultsForDataproviders("publication", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchDatasets(page: number, size: number) {
if (this.reloadDatasets &&
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE)) {
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchDatasets.getResultsForDataproviders("dataset", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadDatasets = false;
}
private countDatasets(page: number, size: number) {
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchDatasets.getResultsForDataproviders("dataset", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchSoftware(page: number, size: number) {
if (this.reloadSoftware &&
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE)) {
this.fetchSoftware.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchSoftware.getResultsForDataproviders("software", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadSoftware = false;
}
private countSoftware(page: number, size: number) {
this.fetchSoftware.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchSoftware.getResultsForDataproviders("software", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchOrps(page: number, size: number) {
if (this.reloadOrps &&
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
this.fetchOrps.searchUtils.status == this.errorCodes.DONE)) {
this.fetchOrps.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchOrps.getResultsForDataproviders("other", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadOrps = false;
}
private countOrps(page: number, size: number) {
this.fetchOrps.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
this.fetchOrps.getResultsForDataproviders("other", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchProjects(page: number, size: number) {
@ -451,10 +442,10 @@ export class DataProviderComponent {
}
)
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties);
} else {
this.loadingRelatedDatasources = false;
}
@ -464,10 +455,10 @@ export class DataProviderComponent {
}
private countRelatedDatasources(page: number, size: number) {
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsPublications.getAggregatorResults("publication", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults("dataset", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsSoftware.getAggregatorResults("software", this.datasourceId, page, size, this.properties);
this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties);
}

View File

@ -25,11 +25,8 @@ import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component'
import {DataProviderComponent} from './dataProvider.component';
import {DataProviderService} from './dataProvider.service';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -42,8 +39,8 @@ import {HelperModule} from "../../utils/helper/helper.module";
imports:
[CommonModule, FormsModule, RouterModule,
TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule,
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule,
SoftwareServiceModule, OrpsServiceModule, PagingModule, Schema2jsonldModule, SEOServiceModule, ShowPublisherModule, HelperModule],
DataProvidersServiceModule, ProjectsServiceModule, SearchResearchResultsServiceModule,
PagingModule, Schema2jsonldModule, SEOServiceModule, ShowPublisherModule, HelperModule],
declarations:
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
RelatedDatasourcesTabComponent, DataProviderComponent, SoftwareTabComponent, OrpsTabComponent

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@ -16,8 +16,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
View all {{fetchDatasets.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchDatasets.results"
[(status)]= "fetchDatasets.searchUtils.status"
<tab-result [results]="fetchDatasets.results"
[status]= "fetchDatasets.searchUtils.status"
type="dataset" urlParam="datasetId">
</tab-result>
</div>
@ -26,7 +26,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class DatasetsTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchDatasets : FetchDatasets;
@Input() fetchDatasets : FetchResearchResults;
@Input() properties:EnvProperties ;
public linkToSearchDatasets = "";
public errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import { FetchOrps } from '../../utils/fetchEntitiesClasses/fetchOrps.class';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@ -16,8 +16,8 @@ import{EnvProperties} from '../../utils/properties/env-properties';
View all {{fetchOrps.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchOrps.results"
[(status)]= "fetchOrps.searchUtils.status"
<tab-result [results]="fetchOrps.results"
[status]= "fetchOrps.searchUtils.status"
type="other" urlParam="orpId">
</tab-result>
</div>
@ -26,7 +26,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class OrpsTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchOrps : FetchOrps;
@Input() fetchOrps : FetchResearchResults;
@Input() properties:EnvProperties ;
public linkToSearchOrps = "";
public errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@ -16,9 +16,9 @@ import{EnvProperties} from '../../utils/properties/env-properties';
View all {{fetchPublications.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchPublications.results"
[(status)]= "fetchPublications.status"
type="publication" urlParam="articleId">
<tab-result [results]="fetchPublications.results"
[status]= "fetchPublications.searchUtils.status"
type="publication" urlParam="articleId">
</tab-result>
</div>
`
@ -26,7 +26,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class PublicationsTabComponent {
@Input() paramsForSearchLink = {};//: string = "";
@Input() fetchPublications : FetchPublications;
@Input() fetchPublications : FetchResearchResults;
@Input() properties:EnvProperties ;
public linkToSearchPublications = "";

View File

@ -1,14 +1,10 @@
import {Component, Input} from '@angular/core';
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import { FetchSoftware } from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
import { FetchOrps } from '../../utils/fetchEntitiesClasses/fetchOrps.class';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import { Observable } from 'rxjs';
import{EnvProperties} from '../../utils/properties/env-properties';
import { RouterHelper } from '../../utils/routerHelper.class';
import { EnvProperties } from '../../utils/properties/env-properties';
@Component({
selector: 'relatedDatasourcesTab',
@ -98,10 +94,10 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class RelatedDatasourcesTabComponent {
@Input() dataproviderId: string;
@Input() fetchPublications : FetchPublications;
@Input() fetchDatasets : FetchDatasets;
@Input() fetchSoftware : FetchSoftware;
@Input() fetchOrps: FetchOrps;
@Input() fetchPublications : FetchResearchResults;
@Input() fetchDatasets : FetchResearchResults;
@Input() fetchSoftware : FetchResearchResults;
@Input() fetchOrps: FetchResearchResults;
// true: preprocessing is not over
@Input() loading: boolean = true;

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import { FetchSoftware } from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
import { FetchResearchResults } from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import{EnvProperties} from '../../utils/properties/env-properties';
@ -16,9 +16,9 @@ import{EnvProperties} from '../../utils/properties/env-properties';
View all {{fetchSoftware.searchUtils.totalResults | number}} results
</a>
</div>
<tab-result [(results)]="fetchSoftware.results"
[(status)]= "fetchSoftware.searchUtils.status"
type="software" urlParam="softwareId">
<tab-result [results]="fetchSoftware.results"
[status]= "fetchSoftware.searchUtils.status"
type="software" urlParam="softwareId">
</tab-result>
</div>
`
@ -26,7 +26,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class SoftwareTabComponent {
@Input() paramsForSearchLink = {};
@Input() fetchSoftware : FetchSoftware;
@Input() fetchSoftware : FetchResearchResults;
@Input() properties:EnvProperties ;
public linkToSearchSoftware = "";
public errorCodes:ErrorCodes = new ErrorCodes();

View File

@ -1,7 +1,6 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {EnvProperties} from '../../utils/properties/env-properties';
@ -38,8 +37,8 @@ import {EnvProperties} from '../../utils/properties/env-properties';
export class StatisticsTabComponent {
@Input() datasourceId;
@Input() fetchPublications : FetchPublications;
@Input() fetchDatasets : FetchDatasets;
@Input() fetchPublications : FetchResearchResults;
@Input() fetchDatasets : FetchResearchResults;
private docsTimelineUrl: string;
private docsTypesUrl:string;

View File

@ -5,11 +5,11 @@ import {Meta, Title} from '@angular/platform-browser';
import {OrganizationService} from '../../services/organization.service';
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
import {ReportsService} from '../../services/reports.service';
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
// import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
// import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchProjectsService} from '../../services/searchProjects.service';
@ -53,7 +53,7 @@ export class OrganizationComponent {
public activeTab: string = "Publications";
// Variables for publications, research data, projects, dataproviders tabs
public fetchPublications: FetchPublications;
public fetchPublications: FetchResearchResults;
public linkToSearchPublications: string = "";
// public fetchDatasets: FetchDatasets;
// public linkToSearchDatasets: string = "";
@ -108,7 +108,7 @@ export class OrganizationComponent {
private route: ActivatedRoute,
private _searchDataprovidersService: SearchDataprovidersService,
private _reportsService: ReportsService,
private _searchPublicationsService: SearchPublicationsService,
private _searchResearchResultsService: SearchResearchResultsService,
// private _searchDatasetsService: SearchDatasetsService,
private _searchProjectsService: SearchProjectsService,
private _meta: Meta,
@ -117,7 +117,7 @@ export class OrganizationComponent {
private helper: HelperService,
private seoService: SEOService) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
// this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@ -227,7 +227,7 @@ export class OrganizationComponent {
var refineFields: string [] = ["funder"];
//this.searchPublications();
this.fetchPublications.getNumForEntity("organization", this.organizationId, this.properties);
this.fetchPublications.getNumForEntity("publication", "organization", this.organizationId, this.properties);
// this.fetchDatasets.getNumForEntity("organization", this.organizationId, this.properties);
this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0, refineFields, this.properties);
@ -286,7 +286,7 @@ export class OrganizationComponent {
//}
private searchPublications() {
this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10, this.properties);
this.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, 1, 10, this.properties);
this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;
//if(this.fetchPublications.searchUtils.totalResults > 0) {
this.reloadPublications = false;
@ -385,7 +385,7 @@ export class OrganizationComponent {
data => {
projects = data[1];
for (let index = 0; index < projects.length; index++) {
this.countPublSub = this._searchPublicationsService.numOfEntityPublications(projects[index].id, "project", this.properties).subscribe(
this.countPublSub = this._searchResearchResultsService.numOfEntityResults("publication", projects[index].id, "project", this.properties).subscribe(
data => {
//if(data == 0 && title) { // if no publications for this project
if (data == 0 && (counter > 1 || title)) { // if no publications for this project

View File

@ -8,14 +8,12 @@ import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {OrganizationServiceModule} from '../../services/organizationService.module';
// import { ProjectsServiceModule} from '../../services/projectsService.module';
import {OrganizationComponent} from './organization.component';
import {LandingModule} from '../landing-utils/landing.module';
import {TabResultModule} from '../../searchPages/searchUtils/tabResult.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
// import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module';
@ -37,7 +35,7 @@ import {HelperModule} from "../../utils/helper/helper.module";
OrganizationServiceModule,
SearchingProjectsTabModule,
OrganizationServiceModule,
PublicationsServiceModule,
SearchResearchResultsServiceModule,
ProjectsServiceModule,
Schema2jsonldModule, SEOServiceModule, HelperModule

View File

@ -6,14 +6,8 @@ import {ProjectService} from './project.service';
import {ProjectInfo} from '../../utils/entities/projectInfo';
import {RouterHelper} from '../../utils/routerHelper.class';
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ModalLoading} from '../../utils/modal/loading.component';
@ -82,13 +76,13 @@ export class ProjectComponent {
private reloadOrps: boolean = true;
// Variables for publications, research data, software tabs
public fetchPublications: FetchPublications;
public fetchPublications: FetchResearchResults;
public linkToSearchPublications = "";
public fetchDatasets: FetchDatasets;
public fetchDatasets: FetchResearchResults;
public linkToSearchDatasets = "";
public fetchSoftware: FetchSoftware;
public fetchSoftware: FetchResearchResults;
public linkToSearchSoftware = "";
public fetchOrps: FetchOrps;
public fetchOrps: FetchResearchResults;
public linkToSearchOrps = "";
public routerHelper: RouterHelper = new RouterHelper();
@ -110,10 +104,7 @@ export class ProjectComponent {
private _piwikService: PiwikService,
private route: ActivatedRoute,
private router: Router,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService,
private _searchSoftwareService: SearchSoftwareService,
private _searchOrpsService: SearchOrpsService,
private _searchResearchResultsService: SearchResearchResultsService,
private _reportsService: ReportsService,
private _meta: Meta,
private _title: Title,
@ -134,10 +125,10 @@ export class ProjectComponent {
this.sub = this.route.queryParams.subscribe(params => {
this.metricsClicked = false;
this.statsClicked = false;
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
this.fetchOrps = new FetchOrps(this._searchOrpsService);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
var title = "Project";
var description = "";
@ -227,10 +218,10 @@ export class ProjectComponent {
this.getProjectInfo(this.projectId);
//this.searchPublications();
this.fetchPublications.getNumForEntity("project", this.projectId, this.properties);
this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties);
this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties);
this.fetchOrps.getNumForEntity("project", this.projectId, this.properties);
this.fetchPublications.getNumForEntity("publication", "project", this.projectId, this.properties);
this.fetchDatasets.getNumForEntity("dataset", "project", this.projectId, this.properties);
this.fetchSoftware.getNumForEntity("software", "project", this.projectId, this.properties);
this.fetchOrps.getNumForEntity("other", "project", this.projectId, this.properties);
}
ngOnDestroy() {
@ -262,7 +253,7 @@ export class ProjectComponent {
}
private searchPublications() {
this.fetchPublications.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, 1, 10, this.properties);
this.linkToSearchPublications = this.properties.searchLinkToAdvancedPublications;// + "?project=" + this.projectId+"&pr=and";
//if(this.fetchPublications.searchUtils.totalResults > 0) {
//this.activeTab = "Publications";
@ -273,7 +264,7 @@ export class ProjectComponent {
}
private searchDatasets() {
this.fetchDatasets.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
this.fetchDatasets.getResultsForEntity("dataset", "project", this.projectId, 1, 10, this.properties);
this.linkToSearchDatasets = this.properties.searchLinkToAdvancedDatasets;// + "?project=" + this.projectId+"&pr=and";
this.reloadDatasets = false;
@ -281,13 +272,13 @@ export class ProjectComponent {
}
private searchSoftware() {
this.fetchSoftware.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
this.fetchSoftware.getResultsForEntity("software", "project", this.projectId, 1, 10, this.properties);
this.linkToSearchSoftware = this.properties.searchLinkToAdvancedSoftware;
this.reloadSoftware = false;
}
private searchOrps() {
this.fetchOrps.getResultsForEntity("project", this.projectId, 1, 10, this.properties);
this.fetchOrps.getResultsForEntity("other", "project", this.projectId, 1, 10, this.properties);
this.linkToSearchOrps = this.properties.searchLinkToAdvancedOrps;
this.reloadOrps = false;
}

View File

@ -13,10 +13,7 @@ import { ProjectComponent } from './project.component';
import {IFrameModule} from '../../utils/iframe.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@ -30,7 +27,7 @@ import {HelperModule} from "../../utils/helper/helper.module";
CommonModule, FormsModule, RouterModule, LandingModule,
LoadingModalModule, AlertModalModule, ErrorMessagesModule,
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule,
PublicationsServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectServiceModule,
SearchResearchResultsServiceModule, ProjectServiceModule,
Schema2jsonldModule, SEOServiceModule, HelperModule
],

View File

@ -1,15 +1,13 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
@ -60,7 +58,7 @@ export class AdvancedSearchDatasetsComponent {
public pagingLimit: number = 0;
public sort: boolean = true;
public isPiwikEnabled;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -131,7 +129,7 @@ export class AdvancedSearchDatasetsComponent {
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Research Data: Execute search query "+parameters);
this._searchDatasetsService.advancedSearchDatasets(parameters, page, size, sortBy, this.properties).subscribe(
this._searchResearchResultsService.advancedSearch("dataset", parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];

View File

@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -13,7 +13,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
@NgModule({
imports: [
CommonModule, FormsModule,
DatasetsServiceModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],

View File

@ -1,15 +1,13 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
@ -60,7 +58,7 @@ export class AdvancedSearchOrpsComponent {
public pagingLimit: number = 0;
public sort: boolean = true;
public isPiwikEnabled;
constructor (private route: ActivatedRoute, private _searchOrpsService: SearchOrpsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -129,7 +127,7 @@ export class AdvancedSearchOrpsComponent {
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Other Research Products: Execute search query "+parameters);
this._searchOrpsService.advancedSearchOrps(parameters, page, size, sortBy, this.properties).subscribe(
this._searchResearchResultsService.advancedSearch("other", parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];

View File

@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import{AdvancedSearchOrpsComponent} from './advancedSearchOrps.component';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -13,7 +13,7 @@ import {OrpsServiceModule} from '../../services/orpsService.module';
@NgModule({
imports: [
CommonModule, FormsModule,
OrpsServiceModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],

View File

@ -2,7 +2,7 @@ import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
@ -62,7 +62,7 @@ export class AdvancedSearchPublicationsComponent {
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
@ -133,7 +133,7 @@ export class AdvancedSearchPublicationsComponent {
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Publications: Execute search query "+parameters);
this._searchPublicationsService.advancedSearchPublications(parameters, page, size, sortBy, this.properties).subscribe(
this._searchResearchResultsService.advancedSearch("publication", parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];

View File

@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -13,7 +13,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
@NgModule({
imports: [
CommonModule, FormsModule,
PublicationsServiceModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],

View File

@ -0,0 +1,215 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'advanced-search-research-results',
template: `
<advanced-search-page
pageTitle="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"
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
[simpleSearchLink]="simpleSearchLink"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[(openaireLink)]=openaireLink
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
searchFormClass="publicationsSearchForm"
[(sort)]=sort >
</advanced-search-page>
`
})
export class AdvancedSearchResearchResultsComponent {
@Input() resultType: string = "publication";
public simpleSearchLink: string = "";
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() hasPrefix: boolean = true;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchFields:SearchFields = new SearchFields();
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.RESULT_FIELDS;
public selectedFields:AdvancedField[] = [];
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact "+this.resultType+"))";
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@Input() openaireLink: string ;
@Input() customFilter:SearchCustomFilter= null;
public pagingLimit: number = 0;
public isPiwikEnabled;
public sort: boolean = true;
properties:EnvProperties;
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
this.pagingLimit = data.envSpecific.pagingLimit;
this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
if(this.resultType == "publication") {
this.simpleSearchLink = this.properties.searchLinkToPublications;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedPublications;
} else if(this.resultType == "dataset") {
this.simpleSearchLink = this.properties.searchLinkToDatasets;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedDatasets;
} else if(this.resultType == "software") {
this.simpleSearchLink = this.properties.searchLinkToSoftware;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedSoftware;
} else if(this.resultType == "other") {
this.simpleSearchLink = this.properties.searchLinkToOrps;
this.searchUtils.baseUrl = this.properties.searchLinkToAdvancedOrps;
}
});
this.searchUtils.status = this.errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchUtils.sortBy = (params['sortBy'])?params['sortBy']:'';
if(this.searchUtils.sortBy && this.searchUtils.sortBy != "resultdateofacceptance,descending" && this.searchUtils.sortBy != "resultdateofacceptance,ascending") {
this.searchUtils.sortBy = "";
}
this.searchPage.fieldIds = this.fieldIds;
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.createQueryParameters(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
sub: any;
public getResults(parameters:string, page: number, size: number, sortBy: string){
if(page > this.pagingLimit) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
if(parameters!= null && parameters != '' ) {
this.csvParams ="&fq=("+this.resourcesQuery +" and (" + parameters + "))";
}else{
this.csvParams ="&fq="+this.resourcesQuery;
}
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this._searchResearchResultsService.advancedSearch(this.resultType, parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
this.handleError("Error getting "+this.getEntityName(this.resultType, true, true), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
public queryChanged($event) {
this.loadPaging = true;
}
private handleError(message: string, error) {
console.error(this.getEntityName(this.resultType, true, true)+" advanced 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");
}
}
}

View File

@ -0,0 +1,27 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {AdvancedSearchResearchResultsComponent} from './advancedSearchResearchResults.component';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],
declarations: [
AdvancedSearchResearchResultsComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
AdvancedSearchResearchResultsComponent
]
})
export class AdvancedSearchResearchResultsModule { }

View File

@ -1,15 +1,13 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Observable} from 'rxjs';
import { Router, ActivatedRoute} from '@angular/router';
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {ActivatedRoute} from '@angular/router';
import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
@ -60,7 +58,7 @@ export class AdvancedSearchSoftwareComponent {
public sort: boolean = true;
properties:EnvProperties;
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.results =[];
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -131,7 +129,7 @@ export class AdvancedSearchSoftwareComponent {
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Software: Execute search query "+parameters);
this._searchSoftwareService.advancedSearchSoftware(parameters, page, size, sortBy, this.properties).subscribe(
this._searchResearchResultsService.advancedSearch("software", parameters, page, size, sortBy, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];

View File

@ -5,14 +5,14 @@ import { FormsModule } from '@angular/forms';
import{AdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
SoftwareServiceModule,
SearchResearchResultsServiceModule,
AdvancedSearchPageModule
],

View File

@ -3,17 +3,13 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
// import{MainSearchRoutingModule} from './mainSearch-routing.module';
import{SearchComponent} from './search.component';
import {SearchComponent} from './search.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {ProjectsServiceModule} from '../../services/projectsService.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
@ -25,8 +21,8 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
DataProvidersServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectsServiceModule,
PublicationsServiceModule, OrganizationsServiceModule,
DataProvidersServiceModule, ProjectsServiceModule,
SearchResearchResultsServiceModule, OrganizationsServiceModule,
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule
],

View File

@ -1,30 +1,21 @@
import {Component, Input, Output} from '@angular/core';
import {EventEmitter, ViewChild} from '@angular/core';
import {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 {Observable} from 'rxjs';
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class';
import {FetchOrganizations} from '../../utils/fetchEntitiesClasses/fetchOrganizations.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {SearchProjectsService} from '../../services/searchProjects.service';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
@ -72,12 +63,12 @@ export class SearchComponent {
public linkToSearchOrps = "";
public linkToSearchOrganizations = "";
public fetchPublications: FetchPublications;
public fetchPublications: FetchResearchResults;
public fetchDataproviders: FetchDataproviders;
public fetchProjects: FetchProjects;
public fetchDatasets: FetchDatasets;
public fetchSoftware: FetchSoftware;
public fetchOrps: FetchOrps;
public fetchDatasets: FetchResearchResults;
public fetchSoftware: FetchResearchResults;
public fetchOrps: FetchResearchResults;
public fetchOrganizations: FetchOrganizations;
public searchFields: SearchFields = new SearchFields();
@ -117,12 +108,9 @@ export class SearchComponent {
constructor(private route: ActivatedRoute,
private _router: Router,
private _searchPublicationsService: SearchPublicationsService,
private _searchResearchResultsService: SearchResearchResultsService,
private _searchDataprovidersService: SearchDataprovidersService,
private _searchProjectsService: SearchProjectsService,
private _searchDatasetsService: SearchDatasetsService,
private _searchSoftwareService: SearchSoftwareService,
private _searchOrpsService: SearchOrpsService,
private _searchOrganizationsService: SearchOrganizationsService,
private _refineFieldResultsService: RefineFieldResultsService,
private location: Location,
@ -131,12 +119,12 @@ export class SearchComponent {
private _piwikService: PiwikService,
private config: ConfigurationService,
private seoService: SEOService) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
this.fetchOrps = new FetchOrps(this._searchOrpsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrganizations = new FetchOrganizations(this._searchOrganizationsService);
}
@ -274,7 +262,7 @@ export class SearchComponent {
this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadPublications = false;
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
this.fetchPublications.getResultsByKeyword("publication", this.keyword, 1, 10, this.properties, this.customFilter);
this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword;
}
}
@ -286,7 +274,7 @@ export class SearchComponent {
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadDatasets = false;
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
this.fetchDatasets.getResultsByKeyword("dataset", this.keyword, 1, 10, this.properties, this.customFilter);
this.linkToSearchDatasets = this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword;
}
}
@ -300,7 +288,7 @@ export class SearchComponent {
( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/) {
this.reloadSoftware = false;
this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
this.fetchSoftware.getResultsByKeyword("software", this.keyword, 1, 10, this.properties, this.customFilter);
this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword;
}
}
@ -312,7 +300,7 @@ export class SearchComponent {
this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&&
this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/) {
this.reloadOrps = false;
this.fetchOrps.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter);
this.fetchOrps.getResultsByKeyword("other", this.keyword, 1, 10, this.properties, this.customFilter);
this.linkToSearchOrps = this.properties.searchLinkToOrps;
}
}
@ -394,7 +382,7 @@ export class SearchComponent {
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
this.fetchPublications.results = [];
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword, this.properties, refineParams).subscribe(
this.subPub = this._searchResearchResultsService.numOfSearchResults("publication", this.keyword, this.properties, refineParams).subscribe(
data => {
this.fetchPublications.searchUtils.totalResults = data;
this.fetchPublications.searchUtils.status = this.errorCodes.DONE;
@ -412,7 +400,7 @@ export class SearchComponent {
if (this.activeTab != "research data" && this.showDatasets) {
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
this.fetchDatasets.results = [];
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword, this.properties, refineParams).subscribe(
this.subData = this._searchResearchResultsService.numOfSearchResults("dataset", this.keyword, this.properties, refineParams).subscribe(
data => {
this.fetchDatasets.searchUtils.totalResults = data;
this.fetchDatasets.searchUtils.status = this.errorCodes.DONE;
@ -430,7 +418,7 @@ export class SearchComponent {
if (this.activeTab != "software" && this.showSoftware) {
this.fetchSoftware.searchUtils.status = this.errorCodes.LOADING;
this.fetchSoftware.results = [];
this.subSoftware = this._searchSoftwareService.numOfSearchSoftware(this.keyword, this.properties, refineParams).subscribe(
this.subSoftware = this._searchResearchResultsService.numOfSearchResults("software", this.keyword, this.properties, refineParams).subscribe(
data => {
this.fetchSoftware.searchUtils.totalResults = data;
this.fetchSoftware.searchUtils.status = this.errorCodes.DONE;
@ -455,7 +443,7 @@ export class SearchComponent {
if (this.activeTab != "other research products" && this.showOrps) {
this.fetchOrps.searchUtils.status = this.errorCodes.LOADING;
this.fetchOrps.results = [];
this.subOrps = this._searchOrpsService.numOfSearchOrps(this.keyword, this.properties, refineParams).subscribe(
this.subOrps = this._searchResearchResultsService.numOfSearchResults("other", this.keyword, this.properties, refineParams).subscribe(
data => {
this.fetchOrps.searchUtils.totalResults = data;
this.fetchOrps.searchUtils.status = this.errorCodes.DONE;

View File

@ -1,17 +1,16 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import {ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {Filter} from '../searchUtils/searchHelperClasses.class';
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchResult} from '../../utils/entities/searchResult';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-datasets',
@ -66,7 +65,7 @@ export class SearchDatasetsComponent {
public sort: boolean = true;
properties: EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchDatasetsService: SearchDatasetsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -135,7 +134,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(parameters != "") {
this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("dataset", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
@ -179,7 +178,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchDatasetsService.searchDatasetsForDataproviders(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("dataset", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -243,7 +242,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchDatasetsService.searchDatasets(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
this.subResults = this._searchResearchResultsService.search("dataset", parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -2,13 +2,12 @@ import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchDatasetsComponent} from './searchDatasets.component';
import {SearchDatasetsComponent} from './searchDatasets.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {DatasetsServiceModule} from '../../services/datasetsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -16,9 +15,8 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
DatasetsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
SearchResearchResultsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [

View File

@ -1,17 +1,16 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import {ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {Filter} from '../searchUtils/searchHelperClasses.class';
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResult} from '../../utils/entities/searchResult';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-orps',
@ -63,7 +62,7 @@ export class SearchOrpsComponent {
public sort: boolean = true;
properties: EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchOrpsService: SearchOrpsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -132,7 +131,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(parameters != "") {
this._searchOrpsService.searchOrpsForEntity(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("other", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -171,7 +170,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchOrpsService.searchOrpsForDataproviders(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("other", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -228,7 +227,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchOrpsService.searchOrps(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
this.subResults = this._searchResearchResultsService.search("other", parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -2,13 +2,12 @@ import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchOrpsComponent} from './searchOrps.component';
import {SearchOrpsComponent} from './searchOrps.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {OrpsServiceModule} from '../../services/orpsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@ -16,8 +15,7 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
OrpsServiceModule,
SearchResearchResultsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],

View File

@ -2,7 +2,7 @@ import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields} from '../../utils/properties/searchFields';
@ -73,7 +73,7 @@ export class SearchPublicationsComponent {
pagingLimit = 0;
public sort: boolean = true;
properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -140,7 +140,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(parameters != "") {
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("publication", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -185,7 +185,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchPublicationsService.searchPublicationsForDataproviders(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("publication", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -250,7 +250,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
this.subResults = this._searchResearchResultsService.search("publication", parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -6,7 +6,7 @@ import{SearchPublicationsComponent} from './searchPublications.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {PublicationsServiceModule} from '../../services/publicationsService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
@ -17,7 +17,7 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
imports: [
CommonModule, FormsModule,
PublicationsServiceModule,
SearchResearchResultsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],

View File

@ -0,0 +1,253 @@
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent} from '../searchUtils/searchPage.component';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-research-results',
template: `
<search-page pageTitle="Search {{ getEntityName(resultType, true, true) | titlecase }}"
formPlaceholderText = "Search for {{ getEntityName(resultType, true, true) | titlecase }}"
[type]="getEntityName(resultType, true, true)" [entityType]="resultType"
[(filters)] = "filters" [(results)] = "results"
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl
(queryChange)="queryChanged($event)"
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
[advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults"
[searchFormClass]="customFilter && customFilter.queryFieldName == 'communityId' ?
'communityPanelBackground' : 'publicationsSearchForm'"
[(openaireLink)]=openaireLink
[(advancedSearchParameters)]=advancedSearchParameters
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
[(sort)]=sort >
</search-page>
`
})
export class SearchResearchResultsComponent {
@Input() resultType: string = "publication";
public advancedSearchLink: string = "";
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@Input() piwikSiteId = null;
@Input() hasPrefix: boolean = true;
public results =[];
public filters =[];
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public baseUrl:string = "";
public sub: any;
public subResults: any;
public searchFields:SearchFields = new SearchFields();
public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS;
public fieldIdsMap=this.searchFields.RESULT_FIELDS;
public urlParams : Map<string, string>;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
public _location:Location;
public CSV: any = {
"columnNames": [
"Title", "Authors", "Publication Year", "DOI",
"Funder", "Project Name (GA Number)", "Access"
],
"export":[]
};
public CSVDownloaded = false;
public csvParams: string;
public disableForms: boolean = false;
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
@Input() openaireLink: string;
@Input() customFilter:SearchCustomFilter= null;
@Input() advancedSearchParameters ;
pagingLimit = 0;
public sort: boolean = true;
properties: EnvProperties;
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.searchUtils.page =1;
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.pagingLimit = data.envSpecific.pagingLimit;
if(this.resultType == "publication") {
this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;
this.baseUrl = this.properties.searchLinkToPublications;
} else if(this.resultType == "dataset") {
this.advancedSearchLink = this.properties.searchLinkToAdvancedDatasets;
this.baseUrl = this.properties.searchLinkToDatasets;
} else if(this.resultType == "software") {
this.advancedSearchLink = this.properties.searchLinkToAdvancedSoftware;
this.baseUrl = this.properties.searchLinkToSoftware;
} else if(this.resultType == "other") {
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrps;
this.baseUrl = this.properties.searchLinkToOrps;
}
});
this.searchPage.refineFields = this.refineFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = this.getEntityName(this.resultType, true, true);
var firstLoad =true;
this.sub = this.route.queryParams.subscribe(params => {
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
this.oldTotalResults = this.searchUtils.totalResults;
}
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
var refine = true;
if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
refine = false;
}
firstLoad = false;
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
this.searchUtils.size = 10;
}
this.searchUtils.sortBy = (params['sortBy'])?params['sortBy']:'';
if(this.searchUtils.sortBy && this.searchUtils.sortBy != "resultdateofacceptance,descending" && this.searchUtils.sortBy != "resultdateofacceptance,ascending") {
this.searchUtils.sortBy = "";
}
this.searchPage.customFilter = this.customFilter;
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy);
});
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
}
}
public getResults(keyword:string,refine:boolean, page: number, size: number, sortBy: string){
var parameters = "";
if(keyword.length > 0){
var DOIs:string[] = DOI.getDOIsFromString(keyword);
var doisParams = "";
for(var i =0 ;i < DOIs.length; i++){
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
}
if(doisParams.length > 0){
parameters += "&"+doisParams;
}else{
parameters = "q=" + keyword;
}
}
this._getResults(parameters,refine,page,size,sortBy);
}
private _getResults(parameters:string,refine:boolean, page: number, size: number, sortBy: string){
if(page > this.pagingLimit) {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
this.csvParams = parameters;
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchResearchResultsService.search(this.resultType, parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
if(refine){
this.filters = data[2];
}
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
//this.searchPage.closeLoading();
this.disableForms = false;
if(this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
//console.log(err);
this.handleError("Error getting "+this.getEntityName(this.resultType, true, true), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
/*if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
//this.searchPage.closeLoading();
this.disableForms = false;
}
);
}
}
public queryChanged($event) {
this.loadPaging = true;
}
private handleError(message: string, error) {
console.error(this.getEntityName(this.resultType, true, true)+" simple Search Page (SearchResearchResultsComponent): "+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");
}
}
}

View File

@ -0,0 +1,28 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import {SearchResearchResultsComponent} from './searchResearchResults.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
SearchResearchResultsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [
SearchResearchResultsComponent
],
providers:[FreeGuard, IsRouteEnabled],
exports: [
SearchResearchResultsComponent
]
})
export class SearchResearchResultsModule { }

View File

@ -1,17 +1,16 @@
import {Component, Input, ViewChild} from '@angular/core';
import { ActivatedRoute} from '@angular/router';
import {ActivatedRoute} from '@angular/router';
import {Location} from '@angular/common';
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
import {Filter} from '../searchUtils/searchHelperClasses.class';
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchPageComponent } from '../searchUtils/searchPage.component';
import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import{EnvProperties} from '../../utils/properties/env-properties';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'search-software',
@ -65,7 +64,7 @@ export class SearchSoftwareComponent {
public sort: boolean = true;
properties: EnvProperties;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
constructor (private route: ActivatedRoute, private _searchSoftwareService: SearchSoftwareService ) {
constructor (private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -134,7 +133,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
if(parameters != "") {
this._searchSoftwareService.searchSoftwareForEntity(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("software", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -179,7 +178,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchSoftwareService.searchSoftwareForDataproviders(parameters, page, size, this.properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("software", parameters, page, size, this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -243,7 +242,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this.results = [];
this.searchUtils.totalResults = 0;
this.subResults = this._searchSoftwareService.searchSoftware(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
this.subResults = this._searchResearchResultsService.search("software", parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, sortBy, this.searchPage.getFields(), this.properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");

View File

@ -2,11 +2,11 @@ import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import{SearchSoftwareComponent} from './searchSoftware.component';
import {SearchSoftwareComponent} from './searchSoftware.component';
import {SearchResultsModule } from '../searchUtils/searchResults.module';
import {SoftwareServiceModule} from '../../services/softwareService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {SearchFormModule} from '../searchUtils/searchForm.module';
import {SearchPageModule} from '../searchUtils/searchPage.module';
import {FreeGuard} from'../../login/freeGuard.guard';
@ -14,10 +14,8 @@ import {FreeGuard} from'../../login/freeGuard.guard';
@NgModule({
imports: [
CommonModule, FormsModule,
SoftwareServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
SearchResearchResultsServiceModule,
SearchFormModule, SearchResultsModule, SearchPageModule
],
declarations: [
SearchSoftwareComponent

View File

@ -30,21 +30,19 @@ export class SearchResearchResultsService {
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
}
searchById (resultType:string, id: string, properties:EnvProperties ):any {
searchById (resultType:string, id: string, properties:EnvProperties ):any {
let url = properties.searchAPIURLLAst+this.getEntityName(resultType,true) +"/"+id+"?format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => this.parseResults(resultType, res, properties)));
}
//???
searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
let link = properties.searchAPIURLLAst+"publications";
searchAggregators (resultType:string, id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
let link = properties.searchAPIURLLAst+this.getEntityName(resultType,true);
let url = link+"?"+"&format=json";
if(params!= null && params != '' ) {
@ -55,15 +53,11 @@ export class SearchResearchResultsService {
}
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => this.parseRefineResults(id, res['refineResults'])));
}
searchByListOfDOI (resultType:string, DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
let link = properties.searchAPIURLLAst+ this.getEntityName(resultType,true);
let url = link+"?"+"&format=json&";
@ -82,8 +76,6 @@ export class SearchResearchResultsService {
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
}
@ -106,17 +98,14 @@ export class SearchResearchResultsService {
url += "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
}
searchResultForEntity (resultType:string, params: string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchAPIURLLAst;
let url = link+params+"/"+this.getEntityName(resultType,true)+ "?format=json";
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties)]));
}
@ -150,6 +139,22 @@ export class SearchResearchResultsService {
this.parsingFunctions.parseTypes(result.types, types, instance);
}
if(resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
result.programmingLanguages = new Array<string>();
if(!Array.isArray(resData['programmingLanguage'])) {
if(resData['programmingLanguage'].classname != "Undetermined" && resData['programmingLanguage'].classname) {
result.programmingLanguages.push(resData['programmingLanguage'].classname);
}
} else {
for(let i=0; i<resData['programmingLanguage'].length; i++) {
if(resData['programmingLanguage'][i].classname != "Undetermined" && resData['programmingLanguage'][i].classname) {
result.programmingLanguages.push(resData['programmingLanguage'][i].classname);
}
}
}
}
if(resData['language'] && resData['language'] != null) {
result.languages = new Array<string>();
@ -185,17 +190,11 @@ export class SearchResearchResultsService {
result['title'] = {"name": '', "accessMode": '', "sc39": ''};
if(Array.isArray(resData['title'])) {
// resData['title'][0].hasOwnProperty("content") {
result['title'].name = String(resData['title'][0].content);
// }
result['title'].name = String(resData['title'][0].content);
} else {
// resData['title'].hasOwnProperty("content") {
result['title'].name = String(resData['title'].content);
// }
result['title'].name = String(resData['title'].content);
}
//result['title'].url = OpenaireProperties.getsearchLinkToPublication();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classid")) {
result['title'].accessMode = resData['bestaccessright'].classid;
@ -208,13 +207,7 @@ export class SearchResearchResultsService {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
/*if(relation['to'].class == "hasAuthor") {
if(result['authors'] == undefined) {
result['authors'] = new Array<{"name": string, "id": string}>();
}
result['authors'].push({"name": relation.fullname, "id": relation['to'].content});
} else */if(relation['to'].class == "isProducedBy") {
if(relation['to'].class == "isProducedBy") {
result['projects'] = this.parseProjects(result['projects'], relation);
}
}
@ -232,9 +225,6 @@ export class SearchResearchResultsService {
for(let i=0; i<length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors;
if(author) {
/*if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}*/
result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
}
}
@ -259,6 +249,18 @@ export class SearchResearchResultsService {
result.embargoEndDate = resData.embargoenddate;
if(!Array.isArray(resData.publisher)) {
result.publisher = resData.publisher;
} else {
for(let i=0; i<resData.publisher.length; i++) {
if(result.publisher != undefined){
result.publisher += ', '+resData['publisher'][i];
} else {
result.publisher = resData['publisher'][i];
}
}
}
results.push(result);
}
@ -285,11 +287,10 @@ export class SearchResearchResultsService {
"id": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "",
"code": ""
}
};
if(relation.title != 'unidentified') {
projects[countProjects]['id'] =
/*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content;
projects[countProjects]['id'] = relation['to'].content;
projects[countProjects]['acronym'] = relation.acronym;
projects[countProjects]['title'] = relation.title;
projects[countProjects]['code'] = relation.code;
@ -326,7 +327,6 @@ export class SearchResearchResultsService {
let result: {"name": string, "id": string, "count": number} = {"name": "", "id": "", "count": 0};
result['name'] = datasource.name;
result['id'] = datasource.id.split("||")[0];
//result['url'] = OpenaireProperties.getsearchLinkToDataProvider()+result['id'];
result['count'] = datasource.count;
if(result['id'] != id && result['name'] != "Unknown Repository") {
@ -338,9 +338,7 @@ export class SearchResearchResultsService {
}
private numOfResults(url: string, properties:EnvProperties): any {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['total']));
}
@ -366,33 +364,32 @@ export class SearchResearchResultsService {
url += "&q=" + StringUtils.URIEncode(params);
}
}
// if(params != "") {
// url += "&q=" + StringUtils.URIEncode(params);
// }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
return this.numOfResults(url, properties);
}
countTotalResults(resultType:string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+this.getEntityName(resultType, true)+"/count?format=json"+refineParams;
return this.numOfResults(url, properties);
}
countTotalResults(resultType:string, properties:EnvProperties, refineParams:string=null):any {
let url = properties.searchAPIURLLAst+this.getEntityName(resultType, true)+"/count?format=json"+refineParams;
return this.numOfResults(url, properties);
}
/*
private quote(word: any): string {
return '"'+word+'"';
}
*/
private getEntityName (entityType:string, plural:boolean){
if(entityType == "publication" ||entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project" ){
if(plural){
return entityType+ "s";
private getEntityName (entityType:string, plural:boolean){
if(entityType == "publication" ||entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project" ){
if(plural){
return entityType+ "s";
}else{
return entityType;
}
}else{
return entityType;
}
}else{
return entityType;
}
}
}

View File

@ -4,7 +4,8 @@ export class SearchResult {
title: { "name": string, "accessMode": string, "sc39": string};
id:string;
DOI:string;
//publications & datasets & orp & organizations:
//publications & datasets & orp & software & organizations:
projects: {"funderShortname": string, "funderName": string, "acronym": string, "title": string, "code": string, "id": string}[];
//datasets & orp & publications & software
@ -12,10 +13,15 @@ export class SearchResult {
year: string;
embargoEndDate: string;
authors: {"fullName": string, "orcid": string}[];
countriesForResults: string[];
languages: string[];
//datasets & orp:
//datasets & orp & software:
publisher: string;
//software
programmingLanguages: string[];
//dataproviders & projects:
organizations: { "name": string, "id": string}[];
@ -42,13 +48,6 @@ export class SearchResult {
countries: string[];
subjects: string[];
//publications & datasets & software & orp
countriesForResults: string[];
languages: string[];
//software
programmingLanguages: string[];
entityType: string;
types: string[];

View File

@ -1,4 +1,4 @@
import {SearchDatasetsService} from '../../services/searchDatasets.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
@ -19,7 +19,7 @@ export class FetchDatasets{
public csvParams: string;
constructor ( private _searchDatasetsService: SearchDatasetsService ) {
constructor ( private _searchResearchResultsService: SearchResearchResultsService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -62,7 +62,7 @@ export class FetchDatasets{
if(customFilter){
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
}
this.subResults = this._searchDatasetsService.searchDatasets(parameters,refineParams, page, size, "", [], properties).subscribe(
this.subResults = this._searchResearchResultsService.search("dataset", parameters,refineParams, page, size, "", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -103,7 +103,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
if(id != "" && entity != "") {
this._searchDatasetsService.numOfEntityDatasets(id, entity, properties).subscribe(
this._searchResearchResultsService.numOfEntityResults("dataset", id, entity, properties).subscribe(
data => {
this.searchUtils.totalResults = data;
@ -151,7 +151,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
if(parameters != "") {
this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("dataset", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Research Data for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -200,7 +200,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchDatasetsService.searchDatasetsForDataproviders(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("dataset", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Research Data for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -239,7 +239,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchDatasetsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
this.subResults = this._searchResearchResultsService.searchAggregators("dataset", id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;

View File

@ -1,4 +1,4 @@
import {SearchOrpsService} from '../../services/searchOrps.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
@ -20,7 +20,7 @@ export class FetchOrps{
public csvParams: string;
constructor ( private _searchOrpsService: SearchOrpsService ) {
constructor ( private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -62,7 +62,7 @@ export class FetchOrps{
if(customFilter){
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
}
this.subResults = this._searchOrpsService.searchOrps(parameters,refineParams, page, size, "", [], properties).subscribe(
this.subResults = this._searchResearchResultsService.search("other", parameters,refineParams, page, size, "", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -95,7 +95,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
if(id != "" && entity != "") {
this._searchOrpsService.numOfEntityOrps(id, entity, properties).subscribe(
this._searchResearchResultsService.numOfEntityResults("other", id, entity, properties).subscribe(
data => {
this.searchUtils.totalResults = data;
@ -132,7 +132,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
if(parameters != "") {
this._searchOrpsService.searchOrpsForEntity(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("other", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -173,7 +173,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchOrpsService.searchOrpsForDataproviders(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("other", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Other Research Products for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -204,7 +204,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
public getAggregatorResults(id:string, page: number, size: number, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchOrpsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
this.subResults = this._searchResearchResultsService.searchAggregators("other", id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;

View File

@ -1,5 +1,5 @@
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
@ -8,6 +8,7 @@ import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs';
import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class';
export class FetchPublications {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
@ -34,7 +35,7 @@ export class FetchPublications {
public CSVDownloaded = false;
public csvParams: string;
constructor ( private _searchPublicationsService: SearchPublicationsService ) {
constructor ( private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
@ -75,7 +76,7 @@ export class FetchPublications {
if(customFilter){
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
}
this.subResults = this._searchPublicationsService.searchPublications(parameters,refineParams, page, size, "", [], properties).subscribe(
this.subResults = this._searchResearchResultsService.search("publication", parameters,refineParams, page, size, "", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -114,7 +115,7 @@ export class FetchPublications {
if(id != "" && entity != "") {
this._searchPublicationsService.numOfEntityPublications(id, entity, properties).subscribe(
this._searchResearchResultsService.numOfEntityResults("publication", id, entity, properties).subscribe(
data => {
this.searchUtils.totalResults = data;
@ -158,7 +159,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
}
if(parameters != "") {
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("publication", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
@ -207,7 +208,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchPublicationsService.searchPublicationsForDataproviders(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("publication", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -245,7 +246,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchPublicationsService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
this.subResults = this._searchResearchResultsService.searchAggregators("publication", id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;

View File

@ -0,0 +1,279 @@
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import {Subject} from 'rxjs';
import{EnvProperties} from '../../utils/properties/env-properties';
import {StringUtils} from '../../utils/string-utils.class';
export class FetchResearchResults {
private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent;
public results =[];
public requestComplete: Subject<void>;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
public sub: any;
public subResults: any;
public searchFields:SearchFields = new SearchFields();
public CSV: any = {
"columnNames": [
"Title", "Authors", "Publication Year", "DOI",
"Funder", "Project Name (GA Number)", "Access"
],
"export":[]
};
public CSVDownloaded = false;
public csvParams: string;
constructor ( private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
this.requestComplete = new Subject<void>();
}
public ngOnDestroy() {
if(this.sub){
this.sub.unsubscribe();
}
if(this.subResults){
this.subResults.unsubscribe();
}
}
public getResultsByKeyword(resultType:string, keyword:string, page: number, size: number, properties:EnvProperties, customFilter:SearchCustomFilter=null){
var parameters = "";
if(keyword.length > 0){
var DOIs:string[] = DOI.getDOIsFromString(keyword);
var doisParams = "";
for(var i =0 ;i < DOIs.length; i++){
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"';
}
if(doisParams.length > 0){
parameters += "&"+doisParams;
}else{
parameters = "q=" + StringUtils.URIEncode(keyword);
}
}
this.searchUtils.status = this.errorCodes.LOADING;
var refineParams = null;
if(customFilter){
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
}
this.subResults = this._searchResearchResultsService.search(this.getEntityName(resultType,false), parameters,refineParams, page, size, "", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for keyword: "+keyword + (doisParams ? "(DOI)" : ""), err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
public getNumForEntity(resultType: string, entity:string, id:string, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.LOADING;
if(id != "" && entity != "") {
this._searchResearchResultsService.numOfEntityResults(this.getEntityName(resultType,false), id, entity, properties).subscribe(
data => {
this.searchUtils.totalResults = data;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
}
public getResultsForEntity(resultType: string, entity:string, id:string, page: number, size: number, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.LOADING;
var parameters = "";
if(entity == "project") {
parameters = "projects/"+id;
} else if(entity == "organization") {
parameters = "organizations/"+id;
}
if(parameters != "") {
this._searchResearchResultsService.searchResultForEntity(this.getEntityName(resultType,false), parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for "+entity+" with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
}
public getResultsForDataproviders(resultType: string, id:string, resultsFrom:string, page: number, size: number, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.LOADING;
var parameters;
if(resultsFrom == "collectedFrom") {
parameters = this.getEntityName(resultType,true)+"?fq=collectedfromdatasourceid exact "+'"'+id+'"';
} else if(resultsFrom == "hostedBy") {
parameters = this.getEntityName(resultType,true)+"?fq=resulthostingdatasourceid exact "+'"'+id+'"';
}
if(parameters != "") {
this._searchResearchResultsService.searchForDataproviders(this.getEntityName(resultType,false), parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for content provider ("+resultsFrom+") with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
}
);
}
}
public getAggregatorResults(resultType: string, id:string, page: number, size: number, properties:EnvProperties){
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchResearchResultsService.searchAggregators(this.getEntityName(resultType,false), id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;
this.searchUtils.status = this.errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = this.errorCodes.NONE;
}
this.requestComplete.complete();
},
err => {
/*console.log(err);
//TODO check erros (service not available, bad request)
// if( ){
// this.searchUtils.status = ErrorCodes.ERROR;
// }
//var errorCodes:ErrorCodes = new ErrorCodes();
//this.searchUtils.status = errorCodes.ERROR;
if(err.status == '404') {
this.searchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.searchUtils.status = this.errorCodes.ERROR;
} else {
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
}*/
this.handleError("Error getting "+this.getEntityName(resultType,true)+" for aggregator with id: "+id, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.requestComplete.complete();
}
);
}
private handleError(message: string, error) {
console.error("Fetch Research Results (class): "+message, error);
}
private getEntityName (entityType:string, plural:boolean){
if(entityType == "publication" ||entityType == "dataset" || entityType == "organization" || entityType == "datasource" || entityType == "project" ){
if(plural){
return entityType+ "s";
}else{
return entityType;
}
}else{
return entityType;
}
}
}

View File

@ -1,4 +1,4 @@
import {SearchSoftwareService} from '../../services/searchSoftware.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import { ErrorCodes} from '../../utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../utils/errorMessages.component';
import {SearchCustomFilter, SearchUtilsClass} from '../../searchPages/searchUtils/searchUtils.class';
@ -20,7 +20,7 @@ export class FetchSoftware{
public csvParams: string;
constructor ( private _searchSoftwareService: SearchSoftwareService ) {
constructor ( private _searchResearchResultsService: SearchResearchResultsService ) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
@ -63,7 +63,7 @@ export class FetchSoftware{
if(customFilter){
refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(customFilter.queryFieldName + " exact " + StringUtils.quote((customFilter.valueId )));
}
this.subResults = this._searchSoftwareService.searchSoftware(parameters,refineParams, page, size, "", [], properties).subscribe(
this.subResults = this._searchResearchResultsService.search("software", parameters,refineParams, page, size, "", [], properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -102,7 +102,7 @@ public getNumForEntity(entity:string, id:string, properties:EnvProperties){
if(id != "" && entity != "") {
this._searchSoftwareService.numOfEntitySoftware(id, entity, properties).subscribe(
this._searchResearchResultsService.numOfEntityResults("software", id, entity, properties).subscribe(
data => {
this.searchUtils.totalResults = data;
@ -146,7 +146,7 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number,
if(parameters != "") {
this._searchSoftwareService.searchSoftwareForEntity(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchResultForEntity("software", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -193,7 +193,7 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
if(parameters != "") {
this._searchSoftwareService.searchSoftwareForDataproviders(parameters, page, size, properties).subscribe(
this._searchResearchResultsService.searchForDataproviders("software", parameters, page, size, properties).subscribe(
data => {
this.searchUtils.totalResults = data[0];
//console.info("search Software for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
@ -231,7 +231,7 @@ public getAggregatorResults(id:string, page: number, size: number, properties:En
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
this.subResults = this._searchSoftwareService.searchAggregators(id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
this.subResults = this._searchResearchResultsService.searchAggregators("software", id, '&fq=collectedfromdatasourceid exact "'+id+'"',"&refine=true&fields=resulthostingdatasource" , page, size, properties).subscribe(
data => {
this.results = data;
this.searchUtils.totalResults = this.results.length;