use search with full index query in compatible and entity registries pages
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44433 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3f972fabcb
commit
413439b784
|
@ -17,6 +17,7 @@ import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
[(results)] = "results" [(totalResults)] = "totalResults" [(keyword)] = "keyword"
|
||||||
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
[(page)] = "page" [(size)] = "size" [(status)] = "status" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
||||||
</search-page>
|
</search-page>
|
||||||
|
<!--table-view [(datasources)] = results></table-view-->
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -63,24 +64,8 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
this.keyword = (params['keyword']?params['keyword']:'');
|
this.keyword = (params['keyword']?params['keyword']:'');
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
this.filters = this.createFilters();
|
this.filters = this.createFilters();
|
||||||
// for(var i=0; i< this.filters.length ; i++){
|
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
||||||
// 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(queryParameters, false, this.page, this.size);
|
||||||
// this.getResults(this.keyword, this.page, this.size, "searchPage");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,17 +77,13 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
this.subResults.unsubscribe();
|
this.subResults.unsubscribe();
|
||||||
} }
|
} }
|
||||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||||
// if(!refine && !this.searchPage){
|
|
||||||
// this.searchPage = new SearchPageComponent(this._location);
|
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||||
// }
|
|
||||||
this.subResults = this._searchDataprovidersService.searchDataproviders(this._prefixQuery+parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
|
||||||
data => {
|
data => {
|
||||||
this.totalResults = data[0];
|
this.totalResults = data[0];
|
||||||
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
// this.filters = data[2];
|
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.status = errorCodes.DONE;
|
||||||
|
@ -126,8 +107,9 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.index;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
|
|
||||||
this._getResults(parameters, false, this.page, this.size);
|
this._getResults(parameters, false, this.page, this.size);
|
||||||
}
|
}
|
||||||
private createFilters():Filter[] {
|
private createFilters():Filter[] {
|
||||||
|
@ -136,19 +118,15 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
var searchFields = new SearchFields();
|
var searchFields = new SearchFields();
|
||||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
||||||
var value_names=[
|
var value_names=[
|
||||||
["Publication Repositories",
|
[
|
||||||
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
|
||||||
|
"Institutional Repositories Aggregators",
|
||||||
"Publication Repositories Aggregators",
|
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
||||||
"Institutional Repositories Aggregators",
|
|
||||||
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
|
|
||||||
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
|
"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)"]];
|
["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=[
|
var value_original_ids=[
|
||||||
["HEADER","pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown","HEADER", "aggregator::pubsrepository::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
|
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
|
||||||
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
|
||||||
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||||
var filters: Filter[] =[];
|
var filters: Filter[] =[];
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
import {Component, Input, ViewChild} from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'table-view',
|
||||||
|
template: `
|
||||||
|
|
||||||
|
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Country</th>
|
||||||
|
<th>Institution</th>
|
||||||
|
<th>Compatibility</th>
|
||||||
|
</tr>
|
||||||
|
<tr *ngFor="let result of datasources">
|
||||||
|
<td>
|
||||||
|
<a href="{{result['title'].url}}">
|
||||||
|
<p *ngIf="result['title'].name != undefined && result['title'].name != ''">
|
||||||
|
{{result['title'].name}}
|
||||||
|
</p>
|
||||||
|
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
|
||||||
|
{{result['title'].url}}
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td> {{result['type']}}</td>
|
||||||
|
<td>....</td>
|
||||||
|
<td>
|
||||||
|
<span *ngFor="let organization of result['organizations'] let i=index">
|
||||||
|
<a *ngIf="organization.url != undefined" href="{{organization.url}}">
|
||||||
|
{{organization.name}}
|
||||||
|
</a>
|
||||||
|
<span *ngIf="organization.url == undefined">
|
||||||
|
{{organization.name}}
|
||||||
|
</span>
|
||||||
|
<span *ngIf="i < result['organizations'].length-1"> ,</span>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>....</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
})
|
||||||
|
export class DatasourceTableViewComponent {
|
||||||
|
@Input() datasources =[];
|
||||||
|
// private results:{name:string, type:string, organizations:string, countries:string, compatibility:string}[] = [];
|
||||||
|
constructor () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ngOnInit() {
|
||||||
|
// // var results:{name:string, type:string, organizations:string, countries:string, compatibility:string}[] = []
|
||||||
|
// for(var i =0; i < this.datasources.length; i++){
|
||||||
|
// var datasource: {name:string, type:string, organizations:string, countries:string, compatibility:string} = {name:"",type:"",organizations:"", countries:"", compatibility:""};
|
||||||
|
// datasource.name = '<a href="'+this.datasources[i]['title'].url+'" >' + (this.datasources[i]['title'].name)?this.datasources[i]['title'].name:this.datasources[i]['title'].url +'</a>';
|
||||||
|
// datasource.type = this.datasources[i]['type'];
|
||||||
|
// this.results.push(datasource);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
private ngOnDestroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
sort(){
|
||||||
|
// objs.sort(function(a,b) {return (a.last_nom > b.last_nom) ? 1 : ((b.last_nom > a.last_nom) ? -1 : 0);} );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -65,7 +65,7 @@ export class SearchEntityRegistriesComponent {
|
||||||
this.page = (params['page']=== undefined)?1:+params['page'];
|
this.page = (params['page']=== undefined)?1:+params['page'];
|
||||||
this.filters = this.createFilters();
|
this.filters = this.createFilters();
|
||||||
|
|
||||||
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
var queryParameters = this.searchPage.getIndexQueryParametersFromUrl(params);
|
||||||
this._getResults(queryParameters, false, this.page, this.size);
|
this._getResults(queryParameters, false, this.page, this.size);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -78,14 +78,12 @@ export class SearchEntityRegistriesComponent {
|
||||||
this.subResults.unsubscribe();
|
this.subResults.unsubscribe();
|
||||||
} }
|
} }
|
||||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
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(
|
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.totalResults = data[0];
|
this.totalResults = data[0];
|
||||||
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
|
||||||
this.results = data[1];
|
this.results = data[1];
|
||||||
// this.filters = data[2];
|
|
||||||
this.searchPage.checkSelectedFilters(this.filters);
|
this.searchPage.checkSelectedFilters(this.filters);
|
||||||
// this.filters = this.searchPage.checkSelectedFilters(data[2]);
|
|
||||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.status = errorCodes.DONE;
|
this.status = errorCodes.DONE;
|
||||||
|
@ -109,32 +107,24 @@ export class SearchEntityRegistriesComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private queryChanged($event) {
|
private queryChanged($event) {
|
||||||
var parameters = $event.value;
|
var parameters = $event.index;
|
||||||
console.info("queryChanged: Execute search query "+parameters);
|
console.info("queryChanged: Execute search query "+parameters);
|
||||||
this._getResults(parameters, false, this.page, this.size);
|
this._getResults(parameters, false, this.page, this.size);
|
||||||
}
|
}
|
||||||
private createFilters():Filter[] {
|
private createFilters():Filter[] {
|
||||||
var filter_names=["Type","Compatibility Level"];
|
var filter_names=["Type","Compatibility Level"];
|
||||||
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityid"];
|
var filter_ids=["datasourcetypeid","datasourcecompatibilityid"];
|
||||||
var searchFields = new SearchFields();
|
var searchFields = new SearchFields();
|
||||||
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
|
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
|
||||||
var value_names=[
|
var value_names=[
|
||||||
[],
|
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
|
||||||
// ["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)"]];
|
["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=[
|
var value_original_ids=[
|
||||||
[],
|
["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
|
||||||
// ["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"]];
|
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
|
||||||
|
|
||||||
var filters: Filter[] =[];
|
var filters: Filter[] =[];
|
||||||
for(var i =0 ; i < filter_names.length;i++){
|
for(var i =0 ; i < filter_names.length;i++){
|
||||||
var values:Value[] = [];
|
var values:Value[] = [];
|
||||||
|
|
|
@ -29,7 +29,7 @@ import {SearchPeopleComponent} from './searchPeople.component';
|
||||||
import {SearchComponent} from './find/search.component';
|
import {SearchComponent} from './find/search.component';
|
||||||
import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component';
|
import {SearchCompatibleDataprovidersComponent} from './dataProviders/compatibleDataProviders.component';
|
||||||
import {SearchEntityRegistriesComponent} from './dataProviders/entityRegistries.component';
|
import {SearchEntityRegistriesComponent} from './dataProviders/entityRegistries.component';
|
||||||
|
import {DatasourceTableViewComponent} from './dataProviders/datasourceTableView.component';
|
||||||
//Advanced
|
//Advanced
|
||||||
import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPublications.component';
|
import { AdvancedSearchPublicationsComponent } from './advanced/advancedSearchPublications.component';
|
||||||
import { AdvancedSearchDataProvidersComponent } from './advanced/advancedSearchDataProviders.component';
|
import { AdvancedSearchDataProvidersComponent } from './advanced/advancedSearchDataProviders.component';
|
||||||
|
@ -64,6 +64,7 @@ import { AdvancedSearchOrganizationsComponent } from './advanced/advancedSearchO
|
||||||
SearchProjectsComponent,
|
SearchProjectsComponent,
|
||||||
SearchCompatibleDataprovidersComponent,
|
SearchCompatibleDataprovidersComponent,
|
||||||
SearchEntityRegistriesComponent,
|
SearchEntityRegistriesComponent,
|
||||||
|
DatasourceTableViewComponent,
|
||||||
SearchDatasetsComponent,
|
SearchDatasetsComponent,
|
||||||
SearchOrganizationsComponent,
|
SearchOrganizationsComponent,
|
||||||
SearchPeopleComponent
|
SearchPeopleComponent
|
||||||
|
|
|
@ -96,6 +96,31 @@ export class SearchPageComponent {
|
||||||
var keyword = params['keyword'];
|
var keyword = params['keyword'];
|
||||||
return (keyword && keyword.length > 0?'q='+keyword+"&op=and":'')+parameters;
|
return (keyword && keyword.length > 0?'q='+keyword+"&op=and":'')+parameters;
|
||||||
}
|
}
|
||||||
|
public getIndexQueryParametersFromUrl(params){
|
||||||
|
var parameters = "";
|
||||||
|
|
||||||
|
for(var i=0; i< this.refineFields.length ; i++){
|
||||||
|
var filterId = this.refineFields[i];
|
||||||
|
|
||||||
|
if(params[filterId] != undefined) {
|
||||||
|
if(this.queryParameters == undefined){
|
||||||
|
this.queryParameters = new Map<string,string>();
|
||||||
|
}
|
||||||
|
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
|
||||||
|
let values = decodeURIComponent(this.queryParameters[filterId]).split(",");
|
||||||
|
var countvalues = 0
|
||||||
|
for(let value of values) {
|
||||||
|
countvalues++;
|
||||||
|
parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
|
||||||
|
|
||||||
|
}
|
||||||
|
parameters+= " ) "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var keyword = params['keyword'];
|
||||||
|
parameters += (keyword && keyword.length > 0?' and '+keyword+' ':'');
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Mark as check the new filters that are selected, when you get them from search
|
* Mark as check the new filters that are selected, when you get them from search
|
||||||
*/
|
*/
|
||||||
|
@ -160,28 +185,38 @@ export class SearchPageComponent {
|
||||||
var fieldId = this.indexIdsMap[filter.filterId];
|
var fieldId = this.indexIdsMap[filter.filterId];
|
||||||
for (let value of filter.values){
|
for (let value of filter.values){
|
||||||
if(value.selected == true){
|
if(value.selected == true){
|
||||||
// if(filter.filterOperator == 'not') {
|
|
||||||
// filterLimits+=((filterLimits.length == 0)?'':' and ') + filter.filterId + '<>'+ value.id;
|
|
||||||
// } else {
|
|
||||||
// filterLimits+=((filterLimits.length == 0)?'':' '+filter.filterOperator+' ') + filter.filterId + '='+ value.id;
|
|
||||||
// }
|
|
||||||
count_selected++;
|
count_selected++;
|
||||||
// if(filter.filterOperator == 'not') {
|
filterLimits+='&' + fieldId+ '='+ value.id+"&" + this.fieldIdsMap[fieldId].operator + "="+((count_selected == 1)?"and":filter.filterOperator);
|
||||||
// filterLimits+='&' + fieldId + '='+ value.id+"&" + this.fieldIdsMap[fieldId].operator + "=not";
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
filterLimits+='&' + fieldId+ '='+ value.id+"&" + this.fieldIdsMap[fieldId].operator + "="+((count_selected == 1)?"and":filter.filterOperator);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allLimits += filterLimits;
|
allLimits += filterLimits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if(this.keyword.length > 0 ){
|
|
||||||
// allLimits= this.keyword + allLimits /*+ ' keyword=' */;
|
|
||||||
// }
|
|
||||||
return (this.keyword.length > 0?'q='+this.keyword+"&op=and":'')+allLimits;
|
return (this.keyword.length > 0?'q='+this.keyword+"&op=and":'')+allLimits;
|
||||||
}
|
}
|
||||||
|
private createIndexQueryParameters(filters:Filter[]){
|
||||||
|
var allLimits="";
|
||||||
|
for (let filter of filters){
|
||||||
|
if(filter.countSelectedValues > 0){
|
||||||
|
var filterLimits="";
|
||||||
|
var count_selected=0;
|
||||||
|
var fieldId = this.indexIdsMap[filter.filterId];
|
||||||
|
for (let value of filter.values){
|
||||||
|
if(value.selected == true){
|
||||||
|
count_selected++;
|
||||||
|
filterLimits+=((count_selected == 1)?" and (":" "+filter.filterOperator+" ") + filter.filterId+ '='+ value.id;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filterLimits+=(filterLimits.length > 0 )?' ) ':'';
|
||||||
|
allLimits += filterLimits;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allLimits += (this.keyword && this.keyword.length > 0?' and '+this.keyword+' ':'');
|
||||||
|
return allLimits;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
private isFiltered(){
|
private isFiltered(){
|
||||||
var filtered=false;
|
var filtered=false;
|
||||||
|
@ -220,10 +255,14 @@ export class SearchPageComponent {
|
||||||
var urlParameters = this.createUrlParameters(this.filters,true);
|
var urlParameters = this.createUrlParameters(this.filters,true);
|
||||||
this.updateBaseUrlWithParameters(this.filters);
|
this.updateBaseUrlWithParameters(this.filters);
|
||||||
var queryParameters = this.createSearchQueryParameters(this.filters);
|
var queryParameters = this.createSearchQueryParameters(this.filters);
|
||||||
|
var indexQuery = this.createIndexQueryParameters(this.filters);
|
||||||
|
|
||||||
this.location.go(location.pathname,urlParameters);
|
this.location.go(location.pathname,urlParameters);
|
||||||
|
|
||||||
this.queryChange.emit({
|
this.queryChange.emit({
|
||||||
value: queryParameters
|
value: queryParameters,
|
||||||
|
index:indexQuery
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,36 @@ export class SearchDataprovidersService {
|
||||||
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]);
|
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||||
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
|
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url += params;
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
//.do(res => console.info(res))
|
||||||
|
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]);
|
||||||
|
}
|
||||||
|
searchEntityRegistries (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||||
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
|
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url += params;
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
//.do(res => console.info(res))
|
||||||
|
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]);
|
||||||
|
}
|
||||||
|
|
||||||
searchDataprovidersForEntity (params: string, page: number, size: number):any {
|
searchDataprovidersForEntity (params: string, page: number, size: number):any {
|
||||||
let link = OpenaireProperties.getSearchAPIURL();
|
let link = OpenaireProperties.getSearchAPIURL();
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class OpenaireProperties {
|
||||||
// private static searchAPIURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
// private static searchAPIURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||||
// private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/";
|
// private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/";
|
||||||
private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
|
||||||
|
private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
|
||||||
|
|
||||||
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
||||||
private static searchServiveURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
private static searchServiveURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
|
||||||
|
@ -107,6 +108,11 @@ export class OpenaireProperties {
|
||||||
public static getSearchAPIURL():string{
|
public static getSearchAPIURL():string{
|
||||||
return this.searchAPIURL;
|
return this.searchAPIURL;
|
||||||
}
|
}
|
||||||
|
//query using full query:
|
||||||
|
//
|
||||||
|
public static getSearchResourcesAPIURL():string{
|
||||||
|
return this.searchResourcesAPIURL;
|
||||||
|
}
|
||||||
public static getSearchAPIURLForEntity(entityType:string):string{
|
public static getSearchAPIURLForEntity(entityType:string):string{
|
||||||
var suffix = "";
|
var suffix = "";
|
||||||
if(entityType == "project"){
|
if(entityType == "project"){
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class SearchFields {
|
||||||
public ADVANCED_DATAPROVIDER_PARAM:string[] = ["q", "officialname",
|
public ADVANCED_DATAPROVIDER_PARAM:string[] = ["q", "officialname",
|
||||||
"engname","subjects", "type","lang","contenttype", "compatibility"];
|
"engname","subjects", "type","lang","contenttype", "compatibility"];
|
||||||
public DATAPROVIDER_INDEX_PARAM_MAP:{ [key:string]:string } = {
|
public DATAPROVIDER_INDEX_PARAM_MAP:{ [key:string]:string } = {
|
||||||
[ "datasourcetypeuiid"]:"type", ["datasourceodlanguages"]:"lang",["datasourceodcontenttypes"]:"contenttype",
|
[ "datasourcetypeuiid"]:"type", [ "datasourcetypeid"]:"datasourcetype", ["datasourceodlanguages"]:"lang",["datasourceodcontenttypes"]:"contenttype",
|
||||||
["datasourcecompatibilityid"]:"compatibility"};
|
["datasourcecompatibilityid"]:"compatibility"};
|
||||||
|
|
||||||
public DATAPROVIDER_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
|
public DATAPROVIDER_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
|
||||||
|
@ -65,12 +65,14 @@ export class SearchFields {
|
||||||
["engname"]:{name:"Start Year",operator:"eg", type:"keyword", indexField:"datasourceenglishname"},
|
["engname"]:{name:"Start Year",operator:"eg", type:"keyword", indexField:"datasourceenglishname"},
|
||||||
["subjects"]: {name:"Subject",operator:"sb", type:"keyword", indexField:"datasourceodsubjects"},
|
["subjects"]: {name:"Subject",operator:"sb", type:"keyword", indexField:"datasourceodsubjects"},
|
||||||
["type"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeuiid"},
|
["type"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeuiid"},
|
||||||
|
["datasourcetype"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeid"},
|
||||||
["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages"},
|
["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages"},
|
||||||
["contenttype"]:{name:"Content Type",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes"},
|
["contenttype"]:{name:"Content Type",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes"},
|
||||||
["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityid"},
|
["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityid"},
|
||||||
|
|
||||||
};
|
};
|
||||||
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];
|
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];
|
||||||
|
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetype","compatibility"];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue