Data Providers:: Fix queries in search page, create advance search page, do the proper query for compatible DP and make filters work, add a page for Entity Registries (first draft)
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44374 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8d530a01de
commit
5437cc97e3
|
@ -20,6 +20,8 @@ import { SearchDatasetsComponent } from './searchPages/searchDatasets.component'
|
|||
import { SearchOrganizationsComponent } from './searchPages/searchOrganizations.component';
|
||||
import { SearchPeopleComponent } from './searchPages/searchPeople.component';
|
||||
import { AdvancedSearchPublicationsComponent } from './searchPages/advanced/advancedSearchPublications.component';
|
||||
import { AdvancedSearchDataProvidersComponent } from './searchPages/advanced/advancedSearchDataProviders.component';
|
||||
|
||||
import { DepositComponent } from './deposit/deposit.component';
|
||||
import { DepositResultComponent } from './deposit/depositResult.component';
|
||||
import { ErrorPageComponent } from './error/errorPage.component';
|
||||
|
@ -27,13 +29,14 @@ import { TestComponent } from './test/test.component';
|
|||
|
||||
import { SearchAllComponent } from './searchAll/searchAll.component';
|
||||
import { SearchCompatibleDataprovidersComponent } from './searchPages/dataProviders/compatibleDataProviders.component';
|
||||
import { SearchEntityRegistriesComponent } from './searchPages/dataProviders/entityRegistries.component';
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{ path: '', component: SearchComponent, pathMatch: 'full' },
|
||||
{ path: 'claims', component: ClaimsAdminComponent },
|
||||
{ path: 'home', component: HomeComponent },
|
||||
{ path: 'claim', component: ClaimComponent },
|
||||
{ path: 'myclaims', component: MyClaimsComponent },
|
||||
{ path: 'home', component: HomeComponent },
|
||||
{ path: 'claim', component: ClaimComponent },
|
||||
{ path: 'myclaims', component: MyClaimsComponent },
|
||||
{ path: 'search/person', component: PersonComponent },
|
||||
{ path: 'search/project', component: ProjectComponent },
|
||||
{ path: 'search/organization', component: OrganizationComponent },
|
||||
|
@ -41,6 +44,7 @@ const appRoutes: Routes = [
|
|||
{ path: 'search/publication', component: PublicationComponent },
|
||||
{ path: 'search/dataprovider', component: DataProviderComponent},
|
||||
{ path: 'search/data-providers', component: SearchCompatibleDataprovidersComponent},
|
||||
{ path: 'search/entity-registries', component: SearchEntityRegistriesComponent},
|
||||
{ path: 'search/find', component: SearchComponent },
|
||||
{ path: 'linking', component: LinkingComponent },
|
||||
{ path: 'bulk-linking', component: BulkLinkingComponent},
|
||||
|
@ -51,12 +55,13 @@ const appRoutes: Routes = [
|
|||
{ path: 'search/find/organizations', component: SearchOrganizationsComponent },
|
||||
{ path: 'search/find/people', component: SearchPeopleComponent },
|
||||
{ path: 'search/advanced/publications', component: AdvancedSearchPublicationsComponent },
|
||||
{ path: 'search/advanced/dataproviders', component: AdvancedSearchDataProvidersComponent },
|
||||
{ path: 'deposit', component: DepositComponent},
|
||||
{ path: 'deposit-results', component: DepositResultComponent},
|
||||
{ path: 'deposit-results', component: DepositResultComponent},
|
||||
{ path: 'test', component: TestComponent},
|
||||
{ path: 'search', component: SearchAllComponent },
|
||||
{ path: 'error', component: ErrorPageComponent},
|
||||
{ path: '**', component: ErrorPageComponent } // it has to be the last one - otherwise the next declaration are ignored
|
||||
{ path: 'error', component: ErrorPageComponent},
|
||||
{ path: '**', component: ErrorPageComponent } // it has to be the last one - otherwise the next declaration are ignored
|
||||
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import { Router, ActivatedRoute} from '@angular/router';
|
||||
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class';
|
||||
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
||||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'advanced-search-dataprovider',
|
||||
template: `
|
||||
<advanced-search-page pageTitle="Advanced Search Data Providers" entityType="dataprovider"
|
||||
[(results)] = "results" [(totalResults)] = "totalResults"
|
||||
[(page)] = "page" [(size)] = "size" [baseUrl] = "baseUrl"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
[(status)] = "status"
|
||||
(queryChange)="queryChanged($event)">
|
||||
</advanced-search-page>
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class AdvancedSearchDataProvidersComponent {
|
||||
private results =[];
|
||||
private filters =[];
|
||||
private totalResults:number = 0 ;
|
||||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
public status:number;
|
||||
private baseUrl: string;
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
|
||||
private fieldIds: string[] = this.searchFields.ADVANCED_DATAPROVIDER_PARAM;
|
||||
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
|
||||
private selectedFields:AdvancedField[] = [];
|
||||
|
||||
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
|
||||
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) {
|
||||
|
||||
this.results =[];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
|
||||
|
||||
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.page = ( page <= 0 ) ? 1 : page;
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.searchPage.selectedFields = this.selectedFields;
|
||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
||||
this.getResults(this.searchPage.createQueryParameters(), this.page, this.size);
|
||||
|
||||
});
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.LOADING;
|
||||
console.info("Advanced Search Publications: Execute search query "+parameters);
|
||||
this._searchDataProvidersService.searchDataproviders(parameters, null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("Adv Search Data providers total="+this.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
this.status = errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
);
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
}
|
||||
|
||||
private queryChanged($event) {
|
||||
var parameters = $event.value;
|
||||
this.getResults(parameters, this.page,this.size);
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -78,6 +78,7 @@ export class AdvancedSearchPublicationsComponent {
|
|||
this.totalResults = data[0];
|
||||
console.info("searchPubl total="+this.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
|
|
|
@ -7,6 +7,7 @@ import {SearchDataprovidersService} from '../../services/searchDataproviders.ser
|
|||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||
|
||||
@Component({
|
||||
selector: 'search-dataproviders',
|
||||
|
@ -29,68 +30,97 @@ export class SearchCompatibleDataprovidersComponent {
|
|||
private keyword = '';
|
||||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
private sub: any;
|
||||
private sub: any; private subResults: any;
|
||||
private _location:Location;
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
private refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
|
||||
private indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
|
||||
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
|
||||
private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
|
||||
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
||||
private _prefixQuery: string = "";
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
||||
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
|
||||
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="
|
||||
+ this._prefixQueryFields[i].values[j] + "&" +
|
||||
this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue;
|
||||
}
|
||||
}
|
||||
this._prefixQuery+="&";
|
||||
}
|
||||
|
||||
private ngOnInit() {
|
||||
this.searchPage.refineFields = this.refineFields;
|
||||
this.searchPage.indexIdsMap = this.indexIdsMap;
|
||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.filters = this.createFilters();
|
||||
for(var i=0; i< this.filters.length ; i++){
|
||||
var filter = this.filters[i];
|
||||
console.info(params);
|
||||
if(params[filter.filterId] != undefined) {
|
||||
let values = params[filter.filterId].split(",");
|
||||
for(let value of values) {
|
||||
for(let filterValue of filter.values) {
|
||||
if(filterValue.id == value) {
|
||||
filterValue.selected = true;
|
||||
filter.countSelectedValues++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.filters = this.createFilters();
|
||||
// for(var i=0; i< this.filters.length ; i++){
|
||||
// var filter = this.filters[i];
|
||||
// console.info(params);
|
||||
// if(params[filter.filterId] != undefined) {
|
||||
// let values = params[filter.filterId].split(",");
|
||||
// for(let value of values) {
|
||||
// for(let filterValue of filter.values) {
|
||||
// if(filterValue.id == value) {
|
||||
// filterValue.selected = true;
|
||||
// filter.countSelectedValues++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||
this._getResults(queryParameters, false, this.page, this.size);
|
||||
// this.getResults(this.keyword, this.page, this.size, "searchPage");
|
||||
});
|
||||
}
|
||||
|
||||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
/*
|
||||
public getResults(parameters:string, page: number, size: number, flag: string){
|
||||
console.info("getResults: Execute search query "+parameters);
|
||||
//q=(not datasourcecompatibilityid exact 'UNKNOWN' )and (not datasourcecompatibilityid exact 'hostedBy' ) and (not datasourcecompatibilityid exact 'notCompatible' )
|
||||
// (datasourcecompatibilityid <> "UNKNOWN") and (datasourcecompatibilityid <> "hostedBy") and (datasourcecompatibilityid <> "notCompatible")
|
||||
this._searchDataprovidersService.searchDataproviders(parameters, page, size, flag).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("searchPubl total="+this.totalResults);
|
||||
this.results = data[1];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
this.status = errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
console.info("error");
|
||||
this.totalResults = 0;
|
||||
this.results = [];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
}
|
||||
*/
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
} }
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
this.subResults = this._searchDataprovidersService.searchDataproviders(this._prefixQuery+parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
this.results = data[1];
|
||||
// this.filters = data[2];
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
this.status = errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
}
|
||||
|
@ -98,29 +128,34 @@ export class SearchCompatibleDataprovidersComponent {
|
|||
private queryChanged($event) {
|
||||
var parameters = $event.value;
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
//this.getResults(parameters, this.page, this.size, "searchPage");
|
||||
this._getResults(parameters, false, this.page, this.size);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["type","compatibility"];
|
||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityid"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; //["datasourcetypeid","openairecompatibilityid"];
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
||||
var value_names=[
|
||||
["Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", "Publication Repositories Aggregators",
|
||||
["Publication Repositories",
|
||||
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
||||
|
||||
"Publication Repositories Aggregators",
|
||||
"Institutional Repositories Aggregators",
|
||||
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
var value_ids=[
|
||||
["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
// var value_ids=[
|
||||
// ["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
// ["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
["HEADER","pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown","HEADER", "aggregator::pubsrepository::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_names.length;i++){
|
||||
var values:Value[] = [];
|
||||
for(var j =0 ; j < value_names[i].length;j++){
|
||||
var value:Value = {name: value_names[i][j], id: value_ids[i][j], number:j, selected:false}
|
||||
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import { ActivatedRoute} from '@angular/router';
|
||||
|
||||
import { Filter, Value} from '../searchUtils/searchHelperClasses.class';
|
||||
|
||||
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
||||
import {SearchResult} from '../../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {SearchFields} from '../../utils/properties/searchFields';
|
||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||
|
||||
@Component({
|
||||
selector: 'search-entity-registries',
|
||||
template: `
|
||||
|
||||
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
|
||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
||||
</search-page>
|
||||
|
||||
`
|
||||
|
||||
})
|
||||
export class SearchEntityRegistriesComponent {
|
||||
public results =[];
|
||||
private filters =[];
|
||||
public totalResults:number = 0 ;
|
||||
private baseUrl:string;
|
||||
public status:number;
|
||||
private keyword = '';
|
||||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
private sub: any; private subResults: any;
|
||||
private _location:Location;
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
private refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
|
||||
private indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
|
||||
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
|
||||
private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[
|
||||
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
|
||||
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
||||
private _prefixQuery: string = "";
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
for(var i = 0; i < this._prefixQueryFields.length; i++ ){
|
||||
for(var j =0; j < this._prefixQueryFields[i].values.length; j++){
|
||||
this._prefixQuery+="&" + this._prefixQueryFields[i].field + "="
|
||||
+ this._prefixQueryFields[i].values[j] + "&" +
|
||||
this._prefixQueryFields[i].opName + "=" + this._prefixQueryFields[i].opValue;
|
||||
}
|
||||
}
|
||||
this._prefixQuery+="&";
|
||||
}
|
||||
|
||||
private ngOnInit() {
|
||||
this.searchPage.refineFields = this.refineFields;
|
||||
this.searchPage.indexIdsMap = this.indexIdsMap;
|
||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.filters = this.createFilters();
|
||||
|
||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||
this._getResults(queryParameters, false, this.page, this.size);
|
||||
});
|
||||
}
|
||||
|
||||
private ngOnDestroy() {
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
} }
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
this.subResults = this._searchDataprovidersService.searchDataproviders(this._prefixQuery+parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
this.results = data[1];
|
||||
// this.filters = data[2];
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
this.status = errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.error(err);
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.ERROR;
|
||||
}
|
||||
);
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
}
|
||||
|
||||
private queryChanged($event) {
|
||||
var parameters = $event.value;
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
this._getResults(parameters, false, this.page, this.size);
|
||||
}
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityid"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
||||
var value_names=[
|
||||
[],
|
||||
// ["Publication Repositories",
|
||||
// "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
||||
// "Publication Repositories Aggregators",
|
||||
// "Institutional Repositories Aggregators",
|
||||
// "Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
||||
// "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
// var value_ids=[
|
||||
// ["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
// ["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
[],
|
||||
// ["HEADER","pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown","HEADER", "aggregator::pubsrepository::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
|
||||
// "datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_names.length;i++){
|
||||
var values:Value[] = [];
|
||||
for(var j =0 ; j < value_names[i].length;j++){
|
||||
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
filters.push(filter);
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
|
||||
}
|
|
@ -28,8 +28,11 @@ import {SearchPeopleComponent} from './searchPeople.component';
|
|||
|
||||
import {SearchComponent} from './find/search.component';
|
||||
import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component';
|
||||
import {SearchEntityRegistriesComponent} from './dataProviders/entityRegistries.component';
|
||||
|
||||
//Advanced
|
||||
import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPublications.component';
|
||||
import { AdvancedSearchDataProvidersComponent } from './advanced/advancedSearchDataProviders.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -50,10 +53,12 @@ import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPu
|
|||
AdvancedSearchFormComponent,
|
||||
SearchPublicationsComponent,
|
||||
AdvancedSearchPublicationsComponent,
|
||||
AdvancedSearchDataProvidersComponent,
|
||||
SearchDataprovidersComponent,
|
||||
SearchComponent,
|
||||
SearchProjectsComponent,
|
||||
SearchCompatibleDataprovidersComponent,
|
||||
SearchEntityRegistriesComponent,
|
||||
SearchDatasetsComponent,
|
||||
SearchOrganizationsComponent,
|
||||
SearchPeopleComponent
|
||||
|
@ -65,6 +70,7 @@ import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPu
|
|||
exports: [
|
||||
SearchAllComponent,
|
||||
AdvancedSearchPublicationsComponent,
|
||||
AdvancedSearchDataProvidersComponent,
|
||||
SearchPublicationsComponent,
|
||||
SearchProjectsComponent,
|
||||
SearchDataprovidersComponent,
|
||||
|
@ -73,6 +79,7 @@ import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPu
|
|||
SearchPeopleComponent,
|
||||
SearchComponent,
|
||||
SearchCompatibleDataprovidersComponent,
|
||||
SearchEntityRegistriesComponent,
|
||||
SearchResultComponent
|
||||
]
|
||||
})
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import {Component, Input, ViewChild} from '@angular/core';
|
||||
import { ActivatedRoute} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
import { Filter, Value} from './searchUtils/searchHelperClasses.class';
|
||||
|
||||
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
|
||||
import {SearchResult} from '../utils/entities/searchResult';
|
||||
import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties';
|
||||
|
@ -30,37 +28,43 @@ export class SearchDataprovidersComponent {
|
|||
private keyword = '';
|
||||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
private sub: any;
|
||||
private sub: any; private subResults: any;
|
||||
private _location:Location;
|
||||
private refineFields = [];
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
private refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
|
||||
private indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP;
|
||||
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
|
||||
|
||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||
//this.results =[];
|
||||
//this.filters =[];
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchDataProviders();
|
||||
if(!this.searchPage){
|
||||
this.searchPage = new SearchPageComponent(this._location);
|
||||
}
|
||||
}
|
||||
|
||||
private ngOnInit() {
|
||||
this.searchPage.refineFields = this.refineFields;
|
||||
this.searchPage.indexIdsMap = this.indexIdsMap;
|
||||
this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.keyword = (params['keyword']?params['keyword']:'');
|
||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
|
||||
this.filters = this.createFilters();
|
||||
this.getResults(this.keyword, true, this.page, this.size);
|
||||
|
||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||
this._getResults(queryParameters, true, this.page, this.size);
|
||||
});
|
||||
}
|
||||
|
||||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public getResultsForEntity(entity:string, id:string, page: number, size: number){
|
||||
|
@ -105,14 +109,18 @@ export class SearchDataprovidersComponent {
|
|||
this._getResults(parameters,refine,page,size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
|
||||
this._searchDataprovidersService.searchDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
if(!refine && !this.searchPage){
|
||||
this.searchPage = new SearchPageComponent(this._location);
|
||||
}
|
||||
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("search Datasets: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
this.results = data[1];
|
||||
this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
this.filters = data[2];
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status = errorCodes.DONE;
|
||||
if(this.totalResults == 0 ){
|
||||
|
@ -168,32 +176,32 @@ export class SearchDataprovidersComponent {
|
|||
this._getResults(parameters, true, this.page, this.size);
|
||||
}
|
||||
|
||||
private createFilters():Filter[] {
|
||||
var filter_names=["Type","Compatibility Level"];
|
||||
var filter_ids=["type","compatibility"];
|
||||
var searchFields = new SearchFields();
|
||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; //["datasourcetypeid","openairecompatibilityid"];
|
||||
var value_names=[
|
||||
["Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", "Publication Repositories Aggregators",
|
||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
var value_ids=[
|
||||
["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
var value_original_ids=[
|
||||
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
var filters: Filter[] =[];
|
||||
for(var i =0 ; i < filter_names.length;i++){
|
||||
var values:Value[] = [];
|
||||
for(var j =0 ; j < value_names[i].length;j++){
|
||||
var value:Value = {name: value_names[i][j], id: value_ids[i][j], number:j, selected:false}
|
||||
values.push(value);
|
||||
}
|
||||
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
filters.push(filter);
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
// private createFilters():Filter[] {
|
||||
// var filter_names=["Type","Compatibility Level"];
|
||||
// var filter_ids=["type","compatibility"];
|
||||
// var searchFields = new SearchFields();
|
||||
// var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS; //["datasourcetypeid","openairecompatibilityid"];
|
||||
// var value_names=[
|
||||
// ["Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository", "Publication Repositories Aggregators",
|
||||
// "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
||||
// ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
|
||||
// var value_ids=[
|
||||
// ["instRepo","thematicRepo", "otherRepo", "pubRepoAggr", "dataRepo", "dataRepoAggr", "jRepo", "jRepoAggr", "cris", "pubCat"],
|
||||
// ["compBasic","comp2", "comp2plus", "comp3","comp2data"]];
|
||||
// var value_original_ids=[
|
||||
// ["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic or aggregator::pubsrepository::institutional or aggregator::pubsrepository::unknown",
|
||||
// "datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||
// ["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||
// var filters: Filter[] =[];
|
||||
// for(var i =0 ; i < filter_names.length;i++){
|
||||
// var values:Value[] = [];
|
||||
// for(var j =0 ; j < value_names[i].length;j++){
|
||||
// var value:Value = {name: value_names[i][j], id: value_ids[i][j], number:j, selected:false}
|
||||
// values.push(value);
|
||||
// }
|
||||
// var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or'}
|
||||
// filters.push(filter);
|
||||
// }
|
||||
// return filters;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ export class SearchDatasetsComponent {
|
|||
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||
// this.getRefineResults();
|
||||
//this.getResults(this.keyword, this.page, this.size, "searchPage");
|
||||
this.searchPage.getSelectedFiltersFromUrl(params);
|
||||
this.getResults(this.keyword, true, this.page, this.size);
|
||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
||||
this.getResults(queryParameters, true, this.page, this.size);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ export class SearchProjectsComponent {
|
|||
private page :number = 1;
|
||||
private size :number = 10;
|
||||
private sub: any;
|
||||
private subResults: any;
|
||||
private searchFields:SearchFields = new SearchFields();
|
||||
private refineFields: string[] = this.searchFields.PROJECT_INDEX;
|
||||
private indexIdsMap: { [key:string]:string } = this.searchFields.PROJECT_INDEX_PARAM_MAP;
|
||||
|
@ -43,7 +44,6 @@ export class SearchProjectsComponent {
|
|||
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.status =errorCodes.LOADING;
|
||||
this.baseUrl = OpenaireProperties.getLinkToSearchProjects();
|
||||
this.refineFields = this.searchFields.PROJECT_INDEX;
|
||||
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,12 @@ export class SearchProjectsComponent {
|
|||
}
|
||||
|
||||
private ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
if(this.sub){
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
if(this.subResults){
|
||||
this.subResults.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||
|
@ -82,7 +87,7 @@ export class SearchProjectsComponent {
|
|||
if(!refine && !this.searchPage){
|
||||
this.searchPage = new SearchPageComponent(this._location);
|
||||
}
|
||||
this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
this.subResults = this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.totalResults = data[0];
|
||||
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||
|
|
|
@ -30,18 +30,18 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
|||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li *ngFor="let id of fieldIds">
|
||||
<a (click)="fieldIdsChanged(i, id)">{{searchFields.PUBLICATION_FIELDS_MAP[id].name}}</a>
|
||||
<a (click)="fieldIdsChanged(i, id)">{{fieldIdsMap[id].name}}</a>
|
||||
</li>
|
||||
</ul-->
|
||||
</div>
|
||||
<input *ngIf = "searchFields.PUBLICATION_FIELDS_MAP[selectedField.id].type == 'keyword'" type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="selectedField.value" name="value[{{i}}]">
|
||||
<input *ngIf = "fieldIdsMap[selectedField.id].type == 'keyword'" type="text" class="form-control" placeholder="Type keywords..." [(ngModel)]="selectedField.value" name="value[{{i}}]">
|
||||
|
||||
|
||||
<div *ngIf = "searchFields.PUBLICATION_FIELDS_MAP[selectedField.id].type == 'vocabulary'" class="input-group">
|
||||
<static-autocomplete2 [(vocabularyId)] = selectedField.id [(list)] = this.fieldList[selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" title = "Languages:" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
|
||||
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'vocabulary'" class="input-group">
|
||||
<static-autocomplete2 [(vocabularyId)] = selectedField.id [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" title = "Languages:" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
|
||||
</div>
|
||||
<div *ngIf = "searchFields.PUBLICATION_FIELDS_MAP[selectedField.id].type == 'refine'" class="input-group">
|
||||
<static-autocomplete2 [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = searchFields.PUBLICATION_FIELDS_MAP[selectedField.id].indexField [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" title = "Languages:" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
|
||||
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'refine'" class="input-group">
|
||||
<static-autocomplete2 [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [fieldName] = fieldIdsMap[selectedField.id].indexField [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" title = "Languages:" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -54,11 +54,11 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
|||
<div class=" input-group">
|
||||
<div class="input-group-btn">
|
||||
<button aria-expanded="false" aria-haspopup="true" class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="dropdownMenu1" type="button">
|
||||
{{searchFields.PUBLICATION_FIELDS_MAP[newFieldId].name}}
|
||||
{{fieldIdsMap[newFieldId].name}}
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||
<li *ngFor="let id of fieldIds">
|
||||
<a (click)="fieldIdsChanged(i, id)">{{searchFields.PUBLICATION_FIELDS_MAP[id].name}}</a>
|
||||
<a (click)="fieldIdsChanged(i, id)">{{fieldIdsMap[id].name}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -127,9 +127,9 @@ export class AdvancedSearchFormComponent {
|
|||
fieldIdsChanged(index: number,id) {
|
||||
this.newFieldId = id;
|
||||
// this.selectedFields[index].id = id;
|
||||
// this.selectedFields[index].name = this.searchFields.PUBLICATION_FIELDS_MAP[id].name;
|
||||
// this.selectedFields[index].name = this.fieldIdsMap[id].name;
|
||||
// // this.selectedFields[index].type = "keyword";
|
||||
// this.selectedFields[index].type = this.searchFields.PUBLICATION_FIELDS_MAP[id].type;
|
||||
// this.selectedFields[index].type = this.fieldIdsMap[id].type;
|
||||
// this.selectedFields[index].value = "";
|
||||
}
|
||||
valueChanged($event,index:number){
|
||||
|
|
|
@ -34,7 +34,6 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
|||
[(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)">
|
||||
</advanced-search-form>
|
||||
|
||||
<div class="text-right" *ngIf="results && results.length>= size">
|
||||
<search-paging [(page)] = "page" [(size)] = "size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
|
||||
|
||||
|
@ -61,6 +60,7 @@ export class AdvancedSearchPageComponent {
|
|||
@Input() selectedFields:AdvancedField[];
|
||||
@Input() baseUrl:string = '';
|
||||
@Input() status: number;
|
||||
@Input() simpleSearchUrl: string;
|
||||
|
||||
private baseURLWithParameters:string = '';
|
||||
|
||||
|
@ -166,7 +166,7 @@ export class AdvancedSearchPageComponent {
|
|||
/*
|
||||
* Update the url with proper parameters. This is used as base url in Paging Component
|
||||
*/
|
||||
public updateBaseUrlWithParameters(filters:Filter[]){
|
||||
public updateBaseUrlWithParameters(){
|
||||
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,24 @@ import { Filter, Value} from './searchHelperClasses.class';
|
|||
selector: 'search-filter',
|
||||
template: `
|
||||
<h4>{{filter.title}}</h4>
|
||||
<p *ngFor = "let value of filter.values.slice(0,5)" >
|
||||
<div *ngFor = "let value of filter.values.slice(0,5)" >
|
||||
<p *ngIf = "value.id != 'HEADER'" >
|
||||
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
|
||||
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}})</span>
|
||||
</p>
|
||||
</p>
|
||||
<h5 *ngIf = "value.id == 'HEADER'" >{{value.name}}</h5>
|
||||
</div>
|
||||
|
||||
<a *ngIf = "!showAll && filter.values.length > 5" (click)="toggleShowAll()" > More</a>
|
||||
<span *ngIf = "filter.values.length > 5 && showAll" >
|
||||
<p *ngFor = "let value of filter.values.slice(5)" >
|
||||
<div *ngFor = "let value of filter.values.slice(5)" >
|
||||
<p *ngIf = "value.id != 'HEADER'" >
|
||||
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
|
||||
<span title = "{{value.name}}"> {{_formatName(value)}}</span><span *ngIf = "showResultCount === true" > ({{value.number}}) </span>
|
||||
</p>
|
||||
<a (click)="toggleShowAll()" > Less</a>
|
||||
</p>
|
||||
<h5 *ngIf = "value.id == 'HEADER'">{{value.name}}</h5>
|
||||
</div>
|
||||
<a (click)="toggleShowAll()" > Less</a>
|
||||
</span>
|
||||
|
||||
`
|
||||
|
|
|
@ -7,15 +7,20 @@ export class ISVocabulariesService {
|
|||
private api ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
|
||||
constructor(private http: Http) {}
|
||||
|
||||
getVocabularyByType(type:string):AutoCompleteValue[]{
|
||||
console.log("getVocabularyByType0"+ type);
|
||||
if( type = "lang"){
|
||||
getVocabularyByType(field:string,entity:string):AutoCompleteValue[]{
|
||||
console.log("getVocabulary field: "+ field + " for entity: "+ entity);
|
||||
if( field == "lang"){
|
||||
return this.getLanguagesJsonFile();
|
||||
}else if ( type == "type"){
|
||||
}else if ( field == "type" && (entity == "publication")){
|
||||
return this.getPublicationTypesJsonFile();
|
||||
}else if( type == "access"){
|
||||
}else if( field == "access" && (entity == "publication")){
|
||||
return this.getAccessModeJsonFile();
|
||||
} else if( field == "type" && (entity == "dataprovider")){
|
||||
return this.getDataProviderTypesJsonFile();
|
||||
} else if( field == "compatibility" && (entity == "dataprovider")){
|
||||
return this.getDataProviderCompatibilityJsonFile();
|
||||
}
|
||||
|
||||
}
|
||||
getLanguages ():any {
|
||||
let url = this.api+"dnet:languages.json";
|
||||
|
|
|
@ -17,7 +17,7 @@ export class SearchDataprovidersService {
|
|||
if(params!= null && params != '' ) {
|
||||
url += params;
|
||||
}
|
||||
if(refineParams!= null && params != '' ) {
|
||||
if(refineParams!= null && refineParams != '' ) {
|
||||
url += refineParams;
|
||||
}
|
||||
url += "&page="+page+"&size="+size;
|
||||
|
|
|
@ -32,8 +32,10 @@ import 'rxjs/Rx';
|
|||
<li><a href="/search/find/people">People</a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="/search/data-providers">Compatible Data providers</a></li>
|
||||
<li><a href="/search/entity-registries">Entity Registries</a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="/search/advanced/publications">Advanced Search Publications</a></li>
|
||||
<li><a href="/search/advanced/dataproviders">Advanced Search Data Providers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
|
|
@ -118,9 +118,9 @@ export class OpenaireProperties {
|
|||
}else if(entityType == "organization"){
|
||||
suffix="organizations/";
|
||||
}else if(entityType == "dataprovider"){
|
||||
suffix="dataproviders/";
|
||||
suffix="datasources/";
|
||||
}else if(entityType == "person"){
|
||||
suffix="peeople/";
|
||||
suffix="people/";
|
||||
}
|
||||
return this.searchAPIURL + suffix;
|
||||
}
|
||||
|
|
|
@ -28,13 +28,14 @@ export class SearchFields {
|
|||
//PROJECT
|
||||
|
||||
public PROJECT_INDEX:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id","fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
||||
public ADVANCED_PROJECTS_PARAM:string[] = ["acronym","title","keywords", "funder", "funderlv0",
|
||||
public ADVANCED_PROJECTS_PARAM:string[] = ["q", "acronym","title","keywords", "funder", "funderlv0",
|
||||
"funderlv1","funderlv2","startyear","endyear","sc39","code"];
|
||||
public PROJECT_INDEX_PARAM_MAP:{ [key:string]:string } = {
|
||||
[ "funderid"]:"funder", ["fundinglevel0_id"]:"funderlv0",["fundinglevel1_id"]:"funderlv1",["fundinglevel2_id"]:"funderlv2",
|
||||
["projectstartyear"]:"startyear",["projectendyear"]:"endyear",["projectecsc39"]:"sc39"};
|
||||
|
||||
public PROJECT_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
|
||||
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
|
||||
["keywords"]:{name:"Keywords",operator:"ky", type:"keyword" , indexField:"projectkeywords"},
|
||||
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"funderid"},
|
||||
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"fundinglevel0_id"},
|
||||
|
@ -47,6 +48,29 @@ export class SearchFields {
|
|||
["title"]: {name:"Title",operator:"tt", type:"keyword", indexField:"projecttitle"},
|
||||
["code"]: {name:"Project Code",operator:"cd", type:"keyword", indexField:"projectcode"}
|
||||
};
|
||||
//DATAPROVIDERS
|
||||
|
||||
public DATAPROVIDER_INDEX:string[] = ["datasourcetypeuiid", "datasourceodlanguages", "datasourceodcontenttypes",
|
||||
"datasourcecompatibilityid"];;
|
||||
public ADVANCED_DATAPROVIDER_PARAM:string[] = ["q", "officialname",
|
||||
"engname","subjects", "type","lang","contenttype", "compatibility"];
|
||||
public DATAPROVIDER_INDEX_PARAM_MAP:{ [key:string]:string } = {
|
||||
[ "datasourcetypeuiid"]:"type", ["datasourceodlanguages"]:"lang",["datasourceodcontenttypes"]:"contenttype",
|
||||
["datasourcecompatibilityid"]:"compatibility"};
|
||||
|
||||
public DATAPROVIDER_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
|
||||
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
|
||||
["officialname"]:{name:"Official Name",operator:"of", type:"keyword", indexField:"datasourceofficialname"},
|
||||
["engname"]:{name:"Start Year",operator:"eg", type:"keyword", indexField:"datasourceenglishname"},
|
||||
["subjects"]: {name:"Subject",operator:"sb", type:"keyword", indexField:"datasourceodsubjects"},
|
||||
["type"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeuiid"},
|
||||
["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages"},
|
||||
["contenttype"]:{name:"Content Type",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes"},
|
||||
["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityid"},
|
||||
|
||||
};
|
||||
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];
|
||||
|
||||
|
||||
|
||||
public DATASET_FIELDS:string[] = ["instancetypenameid", "resultlanguageid", "relfunderid",
|
||||
|
@ -57,7 +81,6 @@ export class SearchFields {
|
|||
public PROJECT_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id","fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
||||
public PEOPLE_FIELDS:string[] = [];
|
||||
//extra pages
|
||||
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeid","openairecompatibilityid"];
|
||||
public ENTITYREGISTRIES_DATAPROVIDER_FIELDS:string[] = [];
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ export class StaticAutocomplete2Component {
|
|||
ngOnInit () {
|
||||
if(this.list == undefined || this.list.length == 0){
|
||||
if(this.vocabularyId){
|
||||
this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId);
|
||||
this.list = this._vocabulariesService.getVocabularyByType(this.vocabularyId, this.entityName);
|
||||
this.afterListFetchedActions();
|
||||
}else if(this.fieldName && this.entityName){
|
||||
this.list = this._refineService.getRefineFieldResultsByFieldName(this.fieldName,this.entityName);
|
||||
|
|
|
@ -65,10 +65,13 @@ app.get('/search/organization', ngApp);
|
|||
app.get('/search/dataset', ngApp);
|
||||
app.get('/search/dataprovider', ngApp);
|
||||
app.get('search/data-providers', ngApp);
|
||||
app.get('search/entity-registries', ngApp);
|
||||
app.get('/search/publication', ngApp);
|
||||
app.get('/search', ngApp);
|
||||
app.get('/search/find/publications', ngApp);
|
||||
app.get('/search/advanced/publications', ngApp);
|
||||
app.get('/search/advanced/dataproviders', ngApp);
|
||||
|
||||
app.get('/search/find/dataproviders', ngApp);
|
||||
app.get('/search/find/projects', ngApp);
|
||||
app.get('/search/find/datasets', ngApp);
|
||||
|
|
Loading…
Reference in New Issue