diff --git a/searchPages/dataProviders/compatibleDataProviders.component.ts b/searchPages/dataProviders/compatibleDataProviders.component.ts index 41ae01bd..e96b3a65 100644 --- a/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -20,7 +20,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" + [csvParams]="csvParams" csvPath="datasources" [disableForms]="disableForms" [tableViewLink]="'/search/content-providers-table'" searchFormClass="compatibleDatasourcesSearchForm"> @@ -48,7 +48,7 @@ export class SearchCompatibleDataprovidersComponent { "export":[] }; public CSVDownloaded = false; - public resourcesQuery = '&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; + public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))'; public csvParams: string; public disableForms: boolean = false; properties:EnvProperties; @@ -82,8 +82,10 @@ properties:EnvProperties; this.searchUtils.page = (params['page']=== undefined)?1:+params['page']; this.filters = this.createFilters(); var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params); + var csvParameters = this.searchPage.getQueryParametersFromUrl(params); + console.info("|"+queryParameters+"|"); - this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size); + this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size); }); } @@ -94,8 +96,12 @@ properties:EnvProperties; if(this.subResults){ this.subResults.unsubscribe(); } } - private _getResults(parameters:string,refine:boolean, page: number, size: number){ - this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; + private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){ + if(csv_parameters.indexOf("fq=") != -1) { + this.csvParams = csv_parameters+" and "+this.resourcesQuery; + } else { + this.csvParams = csv_parameters+"&fq="+this.resourcesQuery; + } //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; @@ -148,9 +154,11 @@ properties:EnvProperties; public queryChanged($event) { var parameters = $event.index; + var csv_parameters = $event.value; + console.info("queryChanged: Execute search query "+parameters); - this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size); + this._getResults(parameters, csv_parameters, false, this.searchUtils.page, this.searchUtils.size); } private createFilters():Filter[] { var filter_names=["Type","Compatibility Level"]; diff --git a/searchPages/dataProviders/entityRegistries.component.ts b/searchPages/dataProviders/entityRegistries.component.ts index c218434e..fbd954ca 100644 --- a/searchPages/dataProviders/entityRegistries.component.ts +++ b/searchPages/dataProviders/entityRegistries.component.ts @@ -19,7 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" + [csvParams]="csvParams" csvPath="datasources" [disableForms]="disableForms" [tableViewLink]="'/search/entity-registries-table'" searchFormClass="entityRegistriesSearchForm"> @@ -52,7 +52,7 @@ export class SearchEntityRegistriesComponent { public disableForms: boolean = false; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; - public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))"; + public resourcesQuery = "((oaftype exact datasource) and(datasourcetypeuiid = other))"; public csvParams: string; properties:EnvProperties; constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) { @@ -85,7 +85,9 @@ properties:EnvProperties; this.filters = this.createFilters(); var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params); - this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size); + var csvParameters = this.searchPage.getQueryParametersFromUrl(params); + + this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size); }); } @@ -96,8 +98,12 @@ properties:EnvProperties; if(this.subResults){ this.subResults.unsubscribe(); } } - private _getResults(parameters:string,refine:boolean, page: number, size: number){ - this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; + private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){ + if(csv_parameters.indexOf("fq=") != -1) { + this.csvParams = csv_parameters+" and "+this.resourcesQuery; + } else { + this.csvParams = csv_parameters+"&fq="+this.resourcesQuery; + } //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; @@ -151,7 +157,9 @@ properties:EnvProperties; public queryChanged($event) { var parameters = $event.index; console.info("queryChanged: Execute search query "+parameters); - this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size); + var csv_parameters = $event.value; + + this._getResults(parameters, csv_parameters, false, this.searchUtils.page, this.searchUtils.size); } private createFilters():Filter[] { var filter_names=["Type","Compatibility Level"]; diff --git a/searchPages/dataProviders/journals.component.ts b/searchPages/dataProviders/journals.component.ts index 72e2aa44..8229afbb 100644 --- a/searchPages/dataProviders/journals.component.ts +++ b/searchPages/dataProviders/journals.component.ts @@ -21,7 +21,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - [csvParams]="csvParams" csvPath="resources" + [csvParams]="csvParams" csvPath="datasources" [disableForms]="disableForms" searchFormClass="journalsSearchForm"> @@ -49,7 +49,7 @@ export class SearchJournalsComponent { "export":[] }; public CSVDownloaded = false; - public resourcesQuery = '&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))'; + public resourcesQuery = '((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))'; //"&query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"; public csvParams: string; public disableForms: boolean = false; @@ -85,7 +85,9 @@ properties:EnvProperties; this.filters = this.createFilters(); var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params); console.info("|"+queryParameters+"|"); - this._getResults(queryParameters, false, this.searchUtils.page, this.searchUtils.size); + var csvParameters = this.searchPage.getQueryParametersFromUrl(params); + + this._getResults(queryParameters, csvParameters, false, this.searchUtils.page, this.searchUtils.size); }); } @@ -96,8 +98,12 @@ properties:EnvProperties; if(this.subResults){ this.subResults.unsubscribe(); } } - private _getResults(parameters:string,refine:boolean, page: number, size: number){ - this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; + private _getResults(parameters:string, csv_parameters:string, refine:boolean, page: number, size: number){ + if(csv_parameters.indexOf("fq=") != -1) { + this.csvParams = csv_parameters+" and "+this.resourcesQuery; + } else { + this.csvParams = csv_parameters+"&fq="+this.resourcesQuery; + } //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; @@ -151,8 +157,9 @@ properties:EnvProperties; public queryChanged($event) { var parameters = $event.index; console.info("queryChanged: Execute search query "+parameters); + var csv_parameters = $event.value; - this._getResults(parameters, false, this.searchUtils.page, this.searchUtils.size); + this._getResults(parameters,csv_parameters, false, this.searchUtils.page, this.searchUtils.size); } private createFilters():Filter[] { var filter_names=["Type","Compatibility Level"];