update angular-universal-starter project, use API resources for advanced Search, put totalResults in searchUtils.class, use new API version for publications simple search

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44726 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2016-11-29 10:42:17 +00:00
parent d454981ea8
commit 7fc478f933
50 changed files with 644 additions and 406 deletions

View File

@ -10,7 +10,7 @@
"watch": "webpack --watch",
"watch:dev": "npm run server & npm run watch",
"clean:dist": "rimraf dist",
"clean:ngc": "rimraf **/*.ngfactory.ts",
"clean:ngc": "rimraf **/*.ngfactory.ts **/*.css.shim.ts",
"prebuild": "npm run clean:dist",
"build": "webpack --progress",
"build:prod:ngc": "npm run clean:ngc && npm run ngc && npm run clean:dist && npm run build:prod",
@ -37,33 +37,34 @@
"Mark Pieszak <mpieszak84@gmail.com>"
],
"dependencies": {
"@angular/common": "~2.2.1",
"@angular/compiler": "~2.2.1",
"@angular/compiler-cli": "~2.2.1",
"@angular/core": "~2.2.1",
"@angular/forms": "~2.2.1",
"@angular/http": "~2.2.1",
"@angular/platform-browser": "~2.2.1",
"@angular/platform-browser-dynamic": "~2.2.1",
"@angular/platform-server": "~2.2.1",
"@angular/router": "~3.2.1",
"@angular/upgrade": "~2.2.1",
"@ngtools/webpack": "~1.1.7",
"@angular/common": "~2.1.2",
"@angular/compiler": "~2.1.2",
"@angular/compiler-cli": "~2.1.2",
"@angular/core": "~2.1.2",
"@angular/forms": "~2.1.2",
"@angular/http": "~2.1.2",
"@angular/platform-browser": "~2.1.2",
"@angular/platform-browser-dynamic": "~2.1.2",
"@angular/platform-server": "~2.1.2",
"@angular/router": "~3.1.2",
"@angular/upgrade": "~2.1.2",
"angular2-express-engine": "~2.1.0-rc.1",
"angular2-platform-node": "~2.1.0-rc.1",
"angular2-universal": "~2.1.0-rc.1",
"angular2-universal-polyfills": "~2.1.0-rc.1",
"body-parser": "^1.15.2",
"bootstrap": "^4.0.0-alpha.4",
"compression": "^1.6.2",
"express": "^4.14.0",
"js.clone": "0.0.3",
"methods": "~1.1.2",
"morgan": "^1.7.0",
"preboot": "~4.5.2",
"rxjs": "5.0.0-beta.12",
"webfontloader": "^1.6.26",
"zone.js": "~0.6.26"
},
"devDependencies": {
"@types/morgan": "^1.7.32",
"@types/body-parser": "0.0.29",
"@types/compression": "0.0.29",
"@types/cookie-parser": "^1.3.29",
@ -74,21 +75,26 @@
"@types/node": "^6.0.38",
"@types/serve-static": "^1.7.27",
"@types/webfontloader": "^1.6.27",
"@ngtools/webpack": "~1.1.7",
"accepts": "^1.3.3",
"angular2-template-loader": "^0.4.0",
"awesome-typescript-loader": "^2.2.4",
"cookie-parser": "^1.4.3",
"express-interceptor": "^1.2.0",
"iltorb": "^1.0.13",
"imports-loader": "^0.6.5",
"json-loader": "^0.5.4",
"nodemon": "^1.10.0",
"raw-loader": "^0.5.1",
"reflect-metadata": "0.1.8",
"rimraf": "^2.5.4",
"string-replace-loader": "^1.0.5",
"ts-helpers": "^1.1.2",
"ts-node": "^1.3.0",
"typescript": "2.0.2",
"v8-lazy-parse-webpack-plugin": "^0.3.0",
"webpack-bundle-analyzer": "1.4.1",
"webpack": "2.1.0-beta.27",
"webpack-bundle-analyzer": "1.4.1",
"webpack-dev-middleware": "^1.8.4",
"webpack-dev-server": "2.1.0-beta.11",
"webpack-merge": "~0.16.0"

View File

@ -7,16 +7,13 @@
let __compiler__ = require('@angular/compiler');
import { __platform_browser_private__ } from '@angular/platform-browser';
import { __core_private__ } from '@angular/core';
let patch = false;
if (!__core_private__['ViewUtils']) {
patch = true;
__core_private__['ViewUtils'] = __core_private__['view_utils'];
}
if (__compiler__ && __compiler__.SelectorMatcher && __compiler__.CssSelector) {
patch = true;
(__compiler__).__compiler_private__ = {
SelectorMatcher: __compiler__.SelectorMatcher,
CssSelector: __compiler__.CssSelector

View File

@ -22,7 +22,7 @@ import {OrganizationService} from '../services/organization.service';
Loading...
</div>
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults > 0">
<h2 *ngIf="organization != undefined">
<span>Data providers for institution: </span>
<a *ngIf="organization['url']!=''" href="{{organization.url}}">
@ -33,10 +33,10 @@ import {OrganizationService} from '../services/organization.service';
</div>
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults > 0">
<p>Please use the information/contacts shown below to deposit your publications.</p>
<!--showDataProviders [dataProviders]=dataProviders></showDataProviders-->
<div class = "text-right" *ngIf = "searchDataprovidersComponent.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDataprovidersComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
</div>

View File

@ -8,17 +8,17 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'datasetsTab',
template: `
<div *ngIf="searchDatasetsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no datasets
</div>
<div *ngIf="searchDatasetsComponent.totalResults > 0">
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchDatasetsComponent.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDatasetsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDatasetsComponent.results" [(status)]= "searchDatasetsComponent.status"></search-result>
</div>
`

View File

@ -8,17 +8,17 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({
selector: 'publicationsTab',
template: `
<div *ngIf="searchPublicationsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no publications
</div>
<div *ngIf="searchPublicationsComponent.totalResults > 0">
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchPublicationsComponent.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchPublicationsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchPublicationsComponent.results" [(status)]= "searchPublicationsComponent.status"></search-result>
</div>
`

View File

@ -15,10 +15,10 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
data-toggle="tab" href="#{{tabs[0].content}}">
{{tabs[0].name}}
<span class="badge" *ngIf="tabs[0].content=='publicationsTab'">
{{searchPublicationsComponent.totalResults}}
{{searchPublicationsComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tabs[0].content=='datasetsTab'">
{{searchDatasetsComponent.totalResults}}
{{searchDatasetsComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -28,10 +28,10 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
(click)="search(tab.content)" data-toggle="tab" href="#{{tab.content}}">
{{tab.name}}
<span class="badge" *ngIf="tab.content=='publicationsTab'">
{{searchPublicationsComponent.totalResults}}
{{searchPublicationsComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tab.content=='datasetsTab'">
{{searchDatasetsComponent.totalResults}}
{{searchDatasetsComponent.searchUtils.totalResults}}
</span>
</a>
</li>

View File

@ -41,7 +41,7 @@
{{organizationInfo.dataProviders.length}}
</span-->
<span class="badge">
{{searchDataprovidersComponent.totalResults}}
{{searchDataprovidersComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -108,17 +108,17 @@
<div id="dataProvidersTab" class="tab-pane fade panel-body">
<!--showDataProviders [dataProviders]="organizationInfo.dataProviders"></showDataProviders-->
<div *ngIf="searchDataprovidersComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no dataproviders
</div>
<div *ngIf="searchDataprovidersComponent.totalResults > 0">
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchDataprovidersComponent.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDataprovidersComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
</div>
</div>

View File

@ -62,8 +62,8 @@ export class OrganizationComponent {
this.subDataprovidersCount = this.route.queryParams.subscribe(params => {
this._searchDataprovidersService.numOfDataproviders("organizations/"+this.organizationId+"/datasources/count").subscribe(
data => {
this.searchDataprovidersComponent.totalResults = data;
console.info("this.searchDataprovidersComponent.totalResults = "+this.searchDataprovidersComponent.totalResults);
this.searchDataprovidersComponent.searchUtils.totalResults = data;
console.info("this.searchDataprovidersComponent.searchUtils.totalResults = "+this.searchDataprovidersComponent.searchUtils.totalResults);
},
err => {
console.error(err);
@ -211,7 +211,7 @@ export class OrganizationComponent {
}
private searchDataprovidersInit() {
if(this.subDataproviders == undefined && this.searchDataprovidersComponent.totalResults > 0) {
if(this.subDataproviders == undefined && this.searchDataprovidersComponent.searchUtils.totalResults > 0) {
this.subDataproviders = this.route.queryParams.subscribe(params => {
this.searchDataproviders();
});

View File

@ -25,7 +25,7 @@
<a data-toggle="tab" href="#publicationsTab">
Publications
<span class="badge">
{{searchPublicationsComponent.totalResults}}
{{searchPublicationsComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -33,7 +33,7 @@
<a data-toggle="tab" href="#researchDataTab">
Research Data
<span class="badge">
{{searchDatasetsComponent.totalResults}}
{{searchDatasetsComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -42,33 +42,33 @@
<div class="tab-content">
<div id="publicationsTab" class="tab-pane fade in active panel-body">
<div *ngIf="searchPublicationsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no publications
</div>
<div *ngIf="searchPublicationsComponent.totalResults > 0">
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchPublicationsComponent.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchPublicationsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchPublicationsComponent.results" [(status)]= "searchPublicationsComponent.status"></search-result>
</div>
</div>
<div id="researchDataTab" class="tab-pane fade panel-body">
<div *ngIf="searchDatasetsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no research data
</div>
<div *ngIf="searchDatasetsComponent.totalResults > 0">
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchDatasetsComponent.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDatasetsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDatasetsComponent.results" [(status)]= "searchDatasetsComponent.status"></search-result>
</div>
</div>

View File

@ -63,7 +63,7 @@ export class PersonComponent {
this.subDatasetsCount = this.route.queryParams.subscribe(params => {
this._searchDatasetsService.numOfEntityDatasets(this.personId, "people/").subscribe(
data => {
this.searchDatasetsComponent.totalResults = data;
this.searchDatasetsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -73,7 +73,7 @@ export class PersonComponent {
}
private searchDatasetsInit() {
if(this.subDatasets == undefined && this.searchDatasetsComponent.totalResults > 0) {
if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) {
this.subDatasets = this.route.queryParams.subscribe(params => {
this.searchDatasets();
});

View File

@ -63,7 +63,7 @@
<a data-toggle="tab" href="#publicationsTab">
Publications
<span class="badge">
{{searchPublicationsComponent.totalResults}}
{{searchPublicationsComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -71,7 +71,7 @@
<a data-toggle="tab" href="#researchDataTab">
Research Data
<span class="badge">
{{searchDatasetsComponent.totalResults}}
{{searchDatasetsComponent.searchUtils.totalResults}}
</span>
</a>
</li>
@ -85,33 +85,33 @@
<div class="tab-content">
<div id="publicationsTab" class="tab-pane fade in active panel-body">
<div *ngIf="searchPublicationsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no publications
</div>
<div *ngIf="searchPublicationsComponent.totalResults > 0">
<div *ngIf="searchPublicationsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchPublicationsComponent.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchPublicationsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchPublicationsComponent.results" [(status)]= "searchPublicationsComponent.status"></search-result>
</div>
</div>
<div id="researchDataTab" class="tab-pane fade panel-body">
<div *ngIf="searchDatasetsComponent.totalResults == 0" class = "alert alert-info " >
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no research data
</div>
<div *ngIf="searchDatasetsComponent.totalResults > 0">
<div *ngIf="searchDatasetsComponent.searchUtils.totalResults > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div class = "text-right" *ngIf = "searchDatasetsComponent.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDatasetsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDatasetsComponent.results" [(status)]= "searchDatasetsComponent.status"></search-result>
</div>
</div>

View File

@ -63,7 +63,7 @@ export class ProjectComponent{
this.subDatasetsCount = this._searchDatasetsService.numOfEntityDatasets(this.projectId, "projects/").subscribe(
data => {
this.searchDatasetsComponent.totalResults = data;
this.searchDatasetsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -99,7 +99,7 @@ export class ProjectComponent{
}
private searchDatasetsInit() {
if(this.subDatasets == undefined && this.searchDatasetsComponent.totalResults > 0) {
if(this.subDatasets == undefined && this.searchDatasetsComponent.searchUtils.totalResults > 0) {
// this.subDatasets = this.route.queryParams.subscribe(params => {
this.searchDatasets();
// });

View File

@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-dataprovider',
template: `
<advanced-search-page pageTitle="Advanced Search Data Providers" entityType="dataprovider"
[(results)] = "results" [(totalResults)] = "totalResults" [baseUrl] = "baseUrl"
[(results)] = "results"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
[(searchUtils)] = "searchUtils"
(queryChange)="queryChanged($event)">
@ -27,17 +27,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchDataProvidersComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// 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 fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -47,18 +47,15 @@ export class AdvancedSearchDataProvidersComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDataProviders;
console.info("Con -base url:"+this.searchUtils.baseUrl );
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
let page = (params['page']=== undefined)?0:+params['page'];
this.searchUtils.page = ( page < 1 ) ? 1 : page;
this.searchPage.fieldIds = this.fieldIds;
this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
@ -75,15 +72,15 @@ export class AdvancedSearchDataProvidersComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchDataProvidersService.searchDataproviders(parameters, null, page, size, []).subscribe(
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("Adv Search Data providers total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("Adv Search Data providers total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -99,9 +96,6 @@ export class AdvancedSearchDataProvidersComponent {
}
);
}
private setFilters(){
//TODO set filters from
}
private queryChanged($event) {
var parameters = $event.value;

View File

@ -14,8 +14,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-datasets',
template: `
<advanced-search-page pageTitle="Advanced Search Datasets" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -26,17 +26,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchDatasetsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// private searchUtils.baseUrl: string;
private searchFields:SearchFields = new SearchFields();
private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_DATASET_PARAM;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATASET_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATASET_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -46,15 +46,15 @@ export class AdvancedSearchDatasetsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDatasets;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -74,15 +74,15 @@ export class AdvancedSearchDatasetsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Datasets: Execute search query "+parameters);
this._searchDatasetsService.searchDatasets(parameters, null, page, size, []).subscribe(
this._searchDatasetsService.advancedSearchDatasets(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Datasets total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("search Datasets total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -14,8 +14,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-organizations',
template: `
<advanced-search-page pageTitle="Advanced Search Organizations" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -26,17 +26,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchOrganizationsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_ORGANIZATION_PARAM;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -46,15 +46,15 @@ export class AdvancedSearchOrganizationsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedOrganizations;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -74,15 +74,15 @@ export class AdvancedSearchOrganizationsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Organizations: Execute search query "+parameters);
this._searchOrganizationsService.searchOrganizations(parameters, null, page, size, []).subscribe(
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Organizations total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("search Organizations total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -14,8 +14,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-organizations',
template: `
<advanced-search-page pageTitle="Advanced Search People" entityType="dataset"
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -26,17 +26,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchPeopleComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_PERSON_PARAM;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PERSON_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PERSON_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -46,15 +46,15 @@ export class AdvancedSearchPeopleComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPeople;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -74,15 +74,15 @@ export class AdvancedSearchPeopleComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search People: Execute search query "+parameters);
this._searchPeopleService.searchPeople(parameters, null, page, size, []).subscribe(
this._searchPeopleService.advancedSearchPeople(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search People total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("search People total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -13,8 +13,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-projects',
template: `
<advanced-search-page pageTitle="Advanced Search Projects" entityType="project"
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -25,17 +25,17 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchProjectsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
// private page :number = 1;
// private size :number = 10;
// public status:number;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
private fieldIds: string[] = this.searchFields.ADVANCED_PROJECTS_PARAM;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PROJECT_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PROJECT_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -45,15 +45,15 @@ export class AdvancedSearchProjectsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.status =errorCodes.LOADING;
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedProjects;
}
ngOnInit() {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.size =errorCodes.LOADING;
this.searchUtils.status =errorCodes.LOADING;
this.sub = this.route.queryParams.subscribe(params => {
let page = (params['page']=== undefined)?1:+params['page'];
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
@ -73,15 +73,15 @@ export class AdvancedSearchProjectsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchProjectsService.searchProjects(parameters, null, page, size, []).subscribe(
this._searchProjectsService.advancedSearchProjects(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("Advanced Search Projects total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("Advanced Search Projects total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -14,8 +14,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
selector: 'advanced-search-publications',
template: `
<advanced-search-page pageTitle="Advanced Search Publications" entityType="publication"
[(results)] = "results" [(totalResults)] = "totalResults"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
(queryChange)="queryChanged($event)">
</advanced-search-page>
@ -26,14 +26,14 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class AdvancedSearchPublicationsComponent {
private results =[];
private filters =[];
private totalResults:number = 0 ;
// private totalResults:number = 0 ;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl: string;
// private baseUrl: string;
private searchFields:SearchFields = new SearchFields();
private fieldIds: string[] = this.searchFields.ADVANCED_SEARCH_PUBLICATIONS_PARAM;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
private selectedFields:AdvancedField[] = [];
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ;
@ -44,7 +44,7 @@ export class AdvancedSearchPublicationsComponent {
this.results =[];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchAdvancedPublications();
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPublications;
@ -71,15 +71,15 @@ export class AdvancedSearchPublicationsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
console.info("Advanced Search Publications: Execute search query "+parameters);
this._searchPublicationsService.searchPublications(parameters, null, page, size, []).subscribe(
this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("searchPubl total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("searchPubl total="+this.searchUtils.totalResults);
this.results = data[1];
this.searchPage.updateBaseUrlWithParameters();
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -95,9 +95,6 @@ export class AdvancedSearchPublicationsComponent {
}
);
}
private setFilters(){
//TODO set filters from
}
private queryChanged($event) {
var parameters = $event.value;

View File

@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
</search-page>
<!--table-view [(datasources)] = results></table-view-->
@ -26,7 +26,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchCompatibleDataprovidersComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
// public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any;
@ -34,7 +34,7 @@ export class SearchCompatibleDataprovidersComponent {
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 fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator: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 = "";
@ -78,14 +78,14 @@ export class SearchCompatibleDataprovidersComponent {
this.subResults = this._searchDataprovidersService.searchCompatibleDataproviders(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.searchUtils.totalResults = data[0];
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -16,7 +16,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
</search-page>
@ -26,7 +26,6 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchEntityRegistriesComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any;
@ -34,7 +33,7 @@ export class SearchEntityRegistriesComponent {
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 fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator: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"]}];
@ -79,14 +78,14 @@ export class SearchEntityRegistriesComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.subResults = this._searchDataprovidersService.searchEntityRegistries(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.searchUtils.totalResults = data[0];
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -38,58 +38,58 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
<ul class="nav nav-tabs">
<li (click)="searchPublications()">
<a data-toggle="tab" href="#pubsTab">
Publications ({{searchPublicationsComponent.totalResults}})
Publications ({{searchPublicationsComponent.searchUtils.totalResults}})
</a>
</li>
<li (click)="searchDatasets()">
<a data-toggle="tab" href="#dataTab">
Datasets ({{searchDatasetsComponent.totalResults}})
Datasets ({{searchDatasetsComponent.searchUtils.totalResults}})
</a>
</li>
<li (click)="searchProjects()">
<a data-toggle="tab" href="#projectsTab">
Projects ({{searchProjectsComponent.totalResults}})
Projects ({{searchProjectsComponent.searchUtils.totalResults}})
</a>
</li>
<li (click)="searchDataProviders()">
<a data-toggle="tab" href="#dataProviderTab">
Data Providers ({{searchDataProvidersComponent.totalResults}})
Data Providers ({{searchDataProvidersComponent.searchUtils.totalResults}})
</a>
</li>
<li (click)="searchOrganizations()">
<a data-toggle="tab" href="#organizationsTab" >
Organizations ({{searchOrganizationsComponent.totalResults}})
Organizations ({{searchOrganizationsComponent.searchUtils.totalResults}})
</a>
</li>
<li (click)="searchPeople()">
<a data-toggle="tab" href="#peopleTab" >
People ({{searchPeopleComponent.totalResults}})
People ({{searchPeopleComponent.searchUtils.totalResults}})
</a>
</li>
</ul>
<div class="tab-content">
<div id="pubsTab" class="tab-pane fade in active panel-body">
<div class = "text-right" *ngIf = "searchPublicationsComponent.totalResults > 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchPublicationsComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchPublications" >View all {{searchPublicationsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchPublicationsComponent.results" [(status)]= "searchPublicationsComponent.status"></search-result>
</div>
<div id="dataTab" class="tab-pane fade in panel-body" >
<div class = "text-right" *ngIf = "searchDatasetsComponent.totalResults > 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDatasetsComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchDatasets" >View all {{searchDatasetsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDatasetsComponent.results" [(status)]= "searchDatasetsComponent.status"></search-result>
</div>
<div id="projectsTab" class="tab-pane fade in panel-body" >
<div class = "text-right" *ngIf = "searchProjectsComponent.totalResults > 10" ><a [href] = "linkToSearchProjects" >View all {{searchProjectsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchProjectsComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchProjects" >View all {{searchProjectsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchProjectsComponent.results" [(status)]= "searchProjectsComponent.status"></search-result>
</div>
<div id="dataProviderTab" class="tab-pane fade in panel-body" >
<div class = "text-right" *ngIf = "searchDataProvidersComponent.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataProvidersComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchDataProvidersComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataProvidersComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDataProvidersComponent.results" [(status)]= "searchDataProvidersComponent.status"></search-result>
</div>
<div id="organizationsTab" class="tab-pane fade in panel-body" >
<div class = "text-right" *ngIf = "searchOrganizationsComponent.totalResults > 10" ><a [href] = "linkToSearchOrganizations" >View all {{searchOrganizationsComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchOrganizationsComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchOrganizations" >View all {{searchOrganizationsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchOrganizationsComponent.results" [(status)]= "searchOrganizationsComponent.status"></search-result>
</div>
<div id="peopleTab" class="tab-pane fade in panel-body" >
<div class = "text-right" *ngIf = "searchPeopleComponent.totalResults > 10" ><a [href] = "linkToSearchPeople" >View all {{searchPeopleComponent.totalResults}} results</a></div>
<div class = "text-right" *ngIf = "searchPeopleComponent.searchUtils.totalResults> 10" ><a [href] = "linkToSearchPeople" >View all {{searchPeopleComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchPeopleComponent.results" [(status)]= "searchPeopleComponent.status"></search-result>
</div>
</div>
@ -280,7 +280,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subPublicationsCount = this.route.queryParams.subscribe(params => {
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
data => {
this.searchPublicationsComponent.totalResults = data;
this.searchPublicationsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -291,7 +291,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subDatasetsCount = this.route.queryParams.subscribe(params => {
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe(
data => {
this.searchDatasetsComponent.totalResults = data;
this.searchDatasetsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -302,7 +302,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subProjectsCount = this.route.queryParams.subscribe(params => {
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe(
data => {
this.searchProjectsComponent.totalResults = data;
this.searchProjectsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -315,7 +315,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subOrganizationsCount = this.route.queryParams.subscribe(params => {
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
data => {
this.searchOrganizationsComponent.totalResults = data;
this.searchOrganizationsComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -326,7 +326,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subPeopleCount = this.route.queryParams.subscribe(params => {
this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe(
data => {
this.searchPeopleComponent.totalResults = data;
this.searchPeopleComponent.searchUtils.totalResults = data;
},
err => {
console.error(err);

View File

@ -38,10 +38,10 @@ import {SearchFields} from '../../utils/properties/searchFields';
<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>
<static-autocomplete2 [(vocabularyId)] = selectedField.id [(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
</div>
<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>
<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] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete2>
</div>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'boolean'" class="input-group">
<span class="input-group-addon">
@ -87,7 +87,7 @@ import {SearchFields} from '../../utils/properties/searchFields';
export class AdvancedSearchFormComponent {
@Input() entityType;
@Input() fieldIds: string[];
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string }} ;
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() selectedFields:AdvancedField[];
@Output() queryChange = new EventEmitter();
newFieldId:string;

View File

@ -36,7 +36,7 @@ import {SearchUtilsClass} from './searchUtils.class';
(queryChange)="queryChanged($event)">
</advanced-search-form>
<!--div class="text-right" *ngIf="results && results.length>= size"-->
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-paging [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" ></search-paging>
<!--/div-->
<div>
@ -54,11 +54,11 @@ export class AdvancedSearchPageComponent {
@Input() results = [];
@Input() entityType;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0;
// @Input() totalResults: number = 0;
@Input() fieldIds: string[];
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string }} ;
@Input() fieldIdsMap:{ [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ;
@Input() selectedFields:AdvancedField[];
@Input() baseUrl:string = '';
// @Input() baseUrl:string = '';
@Input() simpleSearchUrl: string;
private baseURLWithParameters:string = '';
@ -72,9 +72,9 @@ export class AdvancedSearchPageComponent {
}
ngOnInit() {
console.log("Init: AdvancedSearchPageComponent");
this.totalResults = this.results.length;
console.log("Init: AdvancedSearchPageComponent"+this.searchUtils.totalResults+this.searchUtils.baseUrl);
this.updateBaseUrlWithParameters();
// this.searchUtils.totalResults = this.results.length;
}
public getSelectedFiltersFromUrl(params){
for(var i=0; i< this.fieldIds.length ; i++){
@ -126,11 +126,16 @@ export class AdvancedSearchPageComponent {
public createQueryParameters(){
var params="";
for(var i = 0; i< this.selectedFields.length; i++){
console.info("Creating Parameter:" + this.selectedFields[i].id+" :"+this.selectedFields[i].value);
if(this.fieldIdsMap[this.selectedFields[i].id] != undefined && this.selectedFields[i].value != ""){
params +="&"+ this.selectedFields[i].id
+ "="+ encodeURIComponent(this.selectedFields[i].value)+"&"+this.fieldIdsMap[this.selectedFields[i].id].operator
+ "=" + this.selectedFields[i].operatorId;
if(this.selectedFields[i].id == "q"){
params += (i == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
}else{
params += (i == 0 ? "" : this.selectedFields[i].operatorId + " " ) + this.fieldIdsMap[this.selectedFields[i].id].indexField + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
}
// params +="&"+ this.selectedFields[i].id
// + "="+ encodeURIComponent(this.selectedFields[i].value)+"&"+this.fieldIdsMap[this.selectedFields[i].id].operator
// + "=" + this.selectedFields[i].operatorId;
}
}
@ -166,6 +171,9 @@ export class AdvancedSearchPageComponent {
* Update the url with proper parameters. This is used as base url in Paging Component
*/
public updateBaseUrlWithParameters(){
this.baseURLWithParameters = this.baseUrl + this.createUrlParameters(false);
console.info("Going to "+this.searchUtils.baseUrl + this.createUrlParameters(false));
this.baseURLWithParameters = this.searchUtils.baseUrl + this.createUrlParameters(false);
console.info("Updtae!!!"+this.baseURLWithParameters);
}
}

View File

@ -12,7 +12,7 @@ import {SearchUtilsClass} from './searchUtils.class';
<div class="container">
<div class="searchUtils.page-header">
<h1>{{pageTitle}}</h1>
<h1>{{pageTitle}} {{type}}</h1>
</div>
<div>
<div *ngIf="showRefine" class="">
@ -22,12 +22,12 @@ import {SearchUtilsClass} from './searchUtils.class';
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<div *ngIf="isFiltered()" class = "selected-filters-box">
<span *ngIf = "searchUtils.keyword.length > 0">Keywords:
<span>{{searchUtils.keyword}}<a (click) = "clearKeywords() "> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></span>
<span>{{searchUtils.keyword}}<a (click) = "clearKeywords() "> <span class="glyphicon glyphicon-remove clickable" aria-hidden="true"></span></a></span>
</span>
<span *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}: </span>
<span *ngFor="let value of filter.values.slice(0,filter.countSelectedValues); let i = index; let end = last; " >
{{value.name}} <a (click) = "removeFilter(value, filter) "> <span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a>
{{value.name}} <a (click) = "removeFilter(value, filter) "> <span class="glyphicon glyphicon-remove clickable" aria-hidden="true"></span></a>
<span *ngIf="!end">,</span>
</span>
</span>
@ -43,17 +43,17 @@ import {SearchUtilsClass} from './searchUtils.class';
</div>
<div class="col-xs-12 col-sm-9 " >
<search-download [totalResults]="totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
<search-download [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<search-paging [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters"></search-paging>
<search-result [results]="results" [totalResults]="searchUtils.totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div>
</div>
</div>
<div *ngIf="!showRefine" >
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<search-paging [(page)] = "searchUtils.page" [(size)] = "searchUtils.size" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters" [(totalResults)] = "totalResults" ></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
<search-paging [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters"></search-paging>
<search-result [results]="results" [totalResults]="searchUtils.totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div>
</div>
@ -65,9 +65,9 @@ export class SearchPageComponent {
@Input() pageTitle = "";
@Input() results = [];
@Input() filters = [];
@Input() type;
@Input() type:string = "";
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0;
// @Input() totalResults: number = 0;
@Output() queryChange = new EventEmitter();
@Output() downloadClick = new EventEmitter();
@Input() baseUrl:string = '';
@ -75,7 +75,7 @@ export class SearchPageComponent {
@Input() showRefine:boolean = true;
@Input() refineFields = [];
public indexIdsMap: { [key:string]:string } ;
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }};
public fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = '';
@ -91,8 +91,12 @@ export class SearchPageComponent {
ngAfterViewChecked(){
}
public getQueryParametersFromUrl(params){
//TODO when final search is done-allFqs/fq
var parameters = "";
var allFqs = "";
for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i];
@ -103,24 +107,33 @@ export class SearchPageComponent {
}
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
let values = decodeURIComponent(this.queryParameters[filterId]).split(",");
var countvalues = 0
var countvalues = 0;
var fq = "";
for(let value of values) {
countvalues++;
var paramId = this.indexIdsMap[filterId];
parameters+='&' + paramId+ '='+ value+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or");
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " + this.quote(value) ;
}
if(countvalues > 0){
fq="&fq="+fq;
}
allFqs += fq;
}
}
}
}
var keyword = params['keyword'];
return (keyword && keyword.length > 0?'q='+keyword+"&op=and":'')+parameters;
console.info("Type:" + this.type + "filters: "+(this.type == 'publication'?allFqs:parameters));
return (keyword && keyword.length > 0?'q='+keyword+"&op=and":'')+(this.type == 'publication'?allFqs:parameters);
}
public getIndexQueryParametersFromUrl(params){
var parameters = "";
var allFqs = "";
for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i];
var fq = "";
if(params[filterId] != undefined) {
if(this.queryParameters == undefined){
this.queryParameters = new Map<string,string>();
@ -131,14 +144,21 @@ export class SearchPageComponent {
for(let value of values) {
countvalues++;
parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + this.quote(value);
}
parameters+= " ) "
if(countvalues > 0){
fq="&fq="+fq;
}
allFqs += fq;
}
}
var keyword = params['keyword'];
parameters += (keyword && keyword.length > 0?' and '+keyword+' ':'');
return parameters;
// allFqs += ;
return (keyword && keyword.length > 0?' and '+keyword+' ':'')+allFqs;
}
/*
* Mark as check the new filters that are selected, when you get them from search
@ -203,45 +223,59 @@ export class SearchPageComponent {
*
*/
private createSearchQueryParameters(filters:Filter[]){
//TODO when final search is done- remove allLimits/filterLimits and use allFqs/fq
var allLimits="";
var allFqs = "";
for (let filter of filters){
if(filter.countSelectedValues > 0){
var filterLimits="";
var fq = "";
var count_selected=0;
var fieldId = this.indexIdsMap[filter.filterId];
for (let value of filter.values){
if(value.selected == true){
count_selected++;
filterLimits+='&' + fieldId+ '='+ value.id+"&" + this.fieldIdsMap[fieldId].operator + "="+((count_selected == 1)?"and":filter.filterOperator);
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
}
}
fq="&fq="+fq;
allLimits += filterLimits;
allFqs += fq;
}
}
return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+allLimits;
//TODO when final search is done- remove op=and from keyword
return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+(this.type == 'publication'?allFqs:allLimits);
}
private createIndexQueryParameters(filters:Filter[]){
//TODO
var allLimits="";
var allFqs = "";
for (let filter of filters){
if(filter.countSelectedValues > 0){
var filterLimits="";
var count_selected=0;
var fq = "";
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;
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
}
}
filterLimits+=(filterLimits.length > 0 )?' ) ':'';
allLimits += filterLimits;
if(count_selected > 0){
fq="&fq="+fq;
allFqs += fq;
}
}
allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'');
return allLimits;
}
// allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'');
return (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'')+allFqs;
}
//
private isFiltered(){
@ -305,7 +339,6 @@ export class SearchPageComponent {
}
filterChanged($event){
console.log("HEEEEERE");
this.goTo(1);
}
keywordChanged($event) {
@ -380,6 +413,9 @@ export class SearchPageComponent {
}
return "&refine=true"+fieldsStr;
}
private quote(params: string):string {
// return encodeURIComponent('"'+params+'"');
return encodeURIComponent(''+params+'');
}
}

View File

@ -5,22 +5,22 @@ import {Observable} from 'rxjs/Observable';
selector: 'search-paging',
template: `
<div class= "searchPaging">
<div class="text-right" *ngIf="results && totalResults > size">
<paging [currentPage]="page" [totalResults]="totalResults" [baseUrl]="baseUrl" [size]="size"> </paging>
<div class="text-right" *ngIf="results && searchUtils.totalResults > searchUtils.size">
<paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size"> </paging>
</div>
<div class="text-left" *ngIf="results && totalResults > 0">
{{totalResults}} documents, page {{page}} of {{(currentPage())}}
<div class="text-left" *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults}} documents, page {{searchUtils.page}} of {{(totalPages())}}
</div>
</div>
`
})
export class SearchPagingComponent {
@Input() page:number = 1;
@Input() size:number = 1;
@Input() searchUtils;
@Input() results;
@Input() baseUrl:string = "";
@Input() totalResults:number = 0;
@Input() baseUrl;
// @Input() totalResults:number = 0;
constructor () {
}
@ -28,12 +28,12 @@ export class SearchPagingComponent {
}
currentPage(): number {
let curPage: any = this.totalResults/this.size;
if(!(Number.isInteger(curPage))) {
curPage = (parseInt(curPage, 10) + 1);
totalPages(): number {
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return curPage;
return totalPages;
}

View File

@ -4,5 +4,6 @@ export class SearchUtilsClass{
status:number = 1;
keyword:string = "";
baseUrl:string = "";
totalResults = 0;
}

View File

@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search Dataproviders" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
[(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl"
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
</search-page>
@ -26,13 +26,13 @@ export class SearchDataprovidersComponent {
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
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 fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATAPROVIDER_FIELDS_MAP;
private CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
"export":[]
};
@ -82,7 +82,7 @@ console.info("PAGE init = "+this.searchUtils.page);
this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
data => {
this.totalResults = data;
this.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -104,7 +104,7 @@ console.info("PAGE init = "+this.searchUtils.page);
}
this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
data => {
this.totalResults = data;
this.searchUtils.totalResults = data;
},
err => {
console.error(err);
@ -125,13 +125,13 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this._searchDataprovidersService.searchDataprovidersForDeposit(id,type, page, size).subscribe(
data => {
this.totalResults = data[0];
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders forDeposit: [id:"+id+", type:"+type+" ] [total results:"+this.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -158,13 +158,13 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this._searchDataprovidersService.searchDataprovidersForEntity(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -194,8 +194,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
}
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 Data Providers: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Data Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters);
@ -203,7 +203,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -244,7 +244,7 @@ console.info("PAGE queryChanged = "+this.searchUtils.page);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -15,7 +15,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search Datasets" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
@ -25,16 +25,16 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchDatasetsComponent {
public results =[];
private filters: Filter[] =[];
public totalResults:number = 0 ;
// public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.DATASET_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.DATASET_INDEX_PARAM_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.DATASET_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.DATASET_FIELDS_MAP;
private urlParams : Map<string, string>;
private _location:Location;
@ -87,13 +87,13 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this._searchDatasetsService.searchDatasetsForEntity(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Datasets for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Datasets for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -122,13 +122,13 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this._searchDatasetsService.searchDatasetsForDataproviders(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Datasets for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Datasets for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -158,15 +158,15 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
this.subResults = this._searchDatasetsService.searchDatasets(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+"]");
this.searchUtils.totalResults = data[0];
console.info("search Datasets: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -14,7 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search Organizations" type="datasource" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(searchUtils)] = "searchUtils"
[(results)] = "results" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
@ -24,15 +24,15 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchOrganizationsComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
// public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.ORGANIZATION_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.ORGANIZATION_INDEX_PARAM_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.ORGANIZATION_FIELDS_MAP;
private urlParams : Map<string, string>;
private _location:Location;
@ -84,15 +84,15 @@ export class SearchOrganizationsComponent {
}
this.subResults = this._searchOrganizationsService.searchOrganizations(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
data => {
this.totalResults = data[0];
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -16,7 +16,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search People" type="people" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults"
[(results)] = "results"
[(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" [showRefine]=false >
</search-page>
@ -26,9 +26,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchPeopleComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any;
private _location:Location;
private refineFields = [];
@ -122,12 +121,12 @@ export class SearchPeopleComponent {
this._searchPeopleService.searchPeople(parameters, page, searchUtils.size).subscribe(
data => {
this.totalResults = data[0];
console.info("search People total="+this.totalResults);
this.searchUtils.totalResults = data[0];
console.info("search People total="+this.searchUtils.totalResults);
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -156,14 +155,14 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
this._searchPeopleService.searchPeople(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
data => {
this.totalResults = data[0];
console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search People: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = this.searchPage.checkSelectedFilters(data[2]);
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -14,7 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search Projects" type="project" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults"
[(results)] = "results"
[(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page>
@ -24,15 +24,15 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchProjectsComponent {
public results =[];
private filters: Filter[] =[];
public totalResults:number = 0 ;
// public totalResults:number = 0 ;
private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
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;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PROJECT_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PROJECT_FIELDS_MAP;
private urlParams : Map<string, string>;
private _location:Location;
@ -89,8 +89,8 @@ export class SearchProjectsComponent {
}
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+"]");
this.searchUtils.totalResults = data[0];
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters);
@ -98,7 +98,7 @@ export class SearchProjectsComponent {
this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -16,7 +16,7 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
template: `
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults"
[(results)] = "results"
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl (queryChange)="queryChanged($event)" >
</search-page>
@ -26,15 +26,15 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
export class SearchPublicationsComponent {
public results =[];
private filters =[];
public totalResults:number = 0 ;
private searchUtils:SearchUtilsClass = new SearchUtilsClass();
// public totalResults:number = 0 ;
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private baseUrl:string = "";
private sub: any;
private subResults: any;
private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.PUBLICATION_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.PUBLICATION_INDEX_PARAM_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
private fieldIdsMap: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} = this.searchFields.PUBLICATION_FIELDS_MAP;
private urlParams : Map<string, string>;
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
private _location:Location;
@ -43,7 +43,6 @@ export class SearchPublicationsComponent {
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status =errorCodes.LOADING;
this.baseUrl = OpenaireProperties.getLinkToSearchPublications();
console.log("SP con: "+this.baseUrl);
}
@ -51,11 +50,11 @@ export class SearchPublicationsComponent {
this.searchPage.refineFields = this.refineFields;
this.searchPage.indexIdsMap = this.indexIdsMap;
this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.type = "publication";
this.sub = this.route.queryParams.subscribe(params => {
this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
console.log("SP init: "+this.baseUrl);
var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
this._getResults(queryParameters, true, this.searchUtils.page, this.searchUtils.size);
@ -108,13 +107,13 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -143,13 +142,13 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
this._searchPublicationsService.searchPublicationsForDataproviders(parameters, page, size).subscribe(
data => {
this.totalResults = data[0];
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Publications for Dataproviders: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
@ -179,16 +178,15 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
}
this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
data => {
this.totalResults = data[0];
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]");
this.searchUtils.totalResults = data[0];
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters);
console.log("SP getResults: "+this.baseUrl);
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},

View File

@ -23,7 +23,7 @@ export class SearchDataprovidersService {
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+page+"&size="+size;
url += "&page="+(page)+"&size="+size;
let key = url;
if (this._cache.has(key)) {
@ -37,7 +37,30 @@ export class SearchDataprovidersService {
this._cache.set(key, res);
});
}
advancedSearchDataproviders (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact datasource) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
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))"
@ -47,7 +70,8 @@ export class SearchDataprovidersService {
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+page+"&size="+size;
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
@ -69,7 +93,8 @@ export class SearchDataprovidersService {
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+page+"&size="+size;
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
@ -92,6 +117,9 @@ export class SearchDataprovidersService {
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
}
let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact "+id+")";
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));

View File

@ -40,7 +40,30 @@ export class SearchDatasetsService {
});
}
advancedSearchDatasets (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact result) and (resulttypeid exact dataset) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
searchDatasetsForEntity (params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURL();
let url = link+params+"/datasets";

View File

@ -24,11 +24,15 @@ export class SearchOrganizationsService {
if(params!= null && params != '' ) {
url += "((oaftype exact organization and deletedbyinference=false and "+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=*))"+
" and ((organizationlegalname all "+this.quote(params)+") or (organizationlegalshortname all "+this.quote(params)+")) and (collectedfromdatasourcename exact "+collectedFrom+")) "
" and ((organizationlegalname all "+this.quote(params)+") or (organizationlegalshortname all "+this.quote(params)+")) " +
// "and " + this.quote(params) + " " +
"and (collectedfromdatasourcename exact "+collectedFrom+")) "
}
url += "&page="+page+"&size="+size;
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
@ -99,7 +103,30 @@ export class SearchOrganizationsService {
this._cache.set(key, res);
});
}
advancedSearchOrganizations (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact organization) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];

View File

@ -41,7 +41,30 @@ export class SearchPeopleService {
this._cache.set(key, res);
});
}
advancedSearchPeople (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact person) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];

View File

@ -42,7 +42,30 @@ export class SearchProjectsService {
this._cache.set(key, res);
});
}
advancedSearchProjects (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact project) "
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
getFunders():any {
let url = OpenaireProperties.getSearchAPIURL()+"projects?refine=true&fields=funderid&size=0";
let key = url;

View File

@ -18,9 +18,9 @@ export class SearchPublicationsService {
searchPublications (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any {
let link = OpenaireProperties.getSearchAPIURL()+"publications";
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
let url = link+"?";
let url = link+"?"+"&format=json&";
if(params!= null && params != '' ) {
url += params;
}
@ -43,7 +43,30 @@ export class SearchPublicationsService {
});
}
advancedSearchPublications (params: string, page: number, size: number ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL();
var basicQuery = "(oaftype exact result) and (resulttypeid exact publication) ";
url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
}
return this.http.get(url)
.map(res => <any> res.json())
//.do(res => console.info(res))
.map(res => [res['meta'].total, this.parseResults(res['results'])])
.do(res => {
this._cache.set(key, res);
});
}
searchPublicationsForEntity (params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURL();
let url = link+params+"/publications";

View File

@ -9,7 +9,7 @@ import {Dates} from '../utils/dates.class';
template: `
<!--i-frame url="https://google.com" width="30%" height="250"></i-frame-->
<div style ="width:30%; height:250px;" >
<static-autocomplete2 [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete2>
<!--static-autocomplete2 [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete2-->
<div>
<div style ="width:30%; height:250px;" >
<static-autocomplete [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for countries" title = "Countries:" (keywordChange)="keywordChanged($event)" ></static-autocomplete>

View File

@ -15,7 +15,12 @@ export class OpenaireProperties {
private static searchLinkToOrganizations = "search/find/organizations";
private static searchLinkToPeople = "search/find/people";
//Advanced Search pages
private static searchLinkToAdvancedPublications = "search/advanced/publications";
public static searchLinkToAdvancedPublications = "search/advanced/publications";
public static searchLinkToAdvancedProjects = "search/advanced/projects";
public static searchLinkToAdvancedDatasets = "search/advanced/datasets";
public static searchLinkToAdvancedDataProviders = "search/advanced/dataproviders";
public static searchLinkToAdvancedOrganizations = "search/advanced/organizations";
public static searchLinkToAdvancedPeople = "search/advanced/people";
// Services - APIs
@ -28,7 +33,10 @@ export class OpenaireProperties {
// 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 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 searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT-last/rest/v2/api/";
private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT-last/rest/v2/api/resources";
//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/";
@ -99,15 +107,15 @@ export class OpenaireProperties {
public static getLinkToSearchPeople():string{
return this.baseSearchLink + this.searchLinkToPeople;
}
//Advanced Search Pages
public static getLinkToSearchAdvancedPublications(){
return this.baseSearchLink + this.searchLinkToAdvancedPublications;
}
// Services - APIs' getters
public static getSearchAPIURL():string{
return this.searchAPIURL;
}
// Services - APIs' getters
public static getSearchAPIURLLast():string{
return this.searchAPIURLLAst;
}
//query using full query:
//
public static getSearchResourcesAPIURL():string{

View File

@ -3,28 +3,28 @@ export class SearchFields {
//PUBLICATIONS
public PUBLICATION_INDEX:string[] = ["instancetypenameid", "resultlanguageid", "communityid", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
"resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
public ADVANCED_SEARCH_PUBLICATIONS_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0",
"funderlv1","funderlv2","community","access","hostedBy","collectedFrom"];
public PUBLICATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
[ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
["resultacceptanceyear"]:"year",["resultbestlicense"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"};
public PUBLICATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle"},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson"},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher"},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid"},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id"},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id"},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id"},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypenameid"},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguageid"},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid"},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicense'},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid"},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid"}
["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"};
public PUBLICATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson", equalityOperator: "="},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher", equalityOperator: "="},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id", equalityOperator: " exact "},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypenameid", equalityOperator: " exact "},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguageid", equalityOperator: " exact "},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', equalityOperator: " exact "},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "}
};
//PROJECT
@ -35,19 +35,19 @@ export class SearchFields {
[ "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"},
["acronym"]: {name:"Acronym",operator:"ar", type:"keyword", indexField:'projectacronym'},
["title"]: {name:"Title",operator:"tt", type:"keyword", indexField:"projecttitle"},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"funderid"},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"fundinglevel0_id"},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"fundinglevel1_id"},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"fundinglevel2_id"},
["startyear"]:{name:"Start Year",operator:"sa", type:"keyword", indexField:"projectstartyear"},
["endyear"]: {name:"End Year",operator:"ed", type:"keyword", indexField:"projectendyear"},
["sc39"]: {name:"Special Clause 39",operator:"sc", type:"boolean", indexField:"projectecsc39"},
["code"]: {name:"Project Code",operator:"cd", type:"keyword", indexField:"projectcode"}
public PROJECT_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["keywords"]:{name:"Keywords",operator:"ky", type:"keyword" , indexField:"projectkeywords", equalityOperator: "="},
["acronym"]: {name:"Acronym",operator:"ar", type:"keyword", indexField:'projectacronym', equalityOperator: "="},
["title"]: {name:"Title",operator:"tt", type:"keyword", indexField:"projecttitle", equalityOperator: "="},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"funderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"fundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"fundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"fundinglevel2_id", equalityOperator: " exact "},
["startyear"]:{name:"Start Year",operator:"sa", type:"keyword", indexField:"projectstartyear", equalityOperator: " exact "},
["endyear"]: {name:"End Year",operator:"ed", type:"keyword", indexField:"projectendyear", equalityOperator: " exact "},
["sc39"]: {name:"Special Clause 39",operator:"sc", type:"boolean", indexField:"projectecsc39", equalityOperator: " exact "},
["code"]: {name:"Project Code",operator:"cd", type:"keyword", indexField:"projectcode", equalityOperator: " exact "}
};
//DATAPROVIDERS
@ -59,16 +59,16 @@ export class SearchFields {
[ "datasourcetypeuiid"]:"type", [ "datasourcetypeid"]:"datasourcetype", ["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"},
["datasourcetype"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeid"},
["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 DATAPROVIDER_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator:"="},
["officialname"]:{name:"Official Name",operator:"of", type:"keyword", indexField:"datasourceofficialname", equalityOperator:"="},
["engname"]:{name:"English name",operator:"eg", type:"keyword", indexField:"datasourceenglishname", equalityOperator:"="},
["subjects"]: {name:"Subject",operator:"sb", type:"keyword", indexField:"datasourceodsubjects", equalityOperator:"="},
["type"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeuiid", equalityOperator: " exact "},
["datasourcetype"]:{name:"Type",operator:"tp", type:"vocabulary" , indexField:"datasourcetypeid", equalityOperator: " exact "},
["lang"]:{name:"Language",operator:"ln", type:"vocabulary", indexField:"datasourceodlanguages", equalityOperator: " exact "},
["contenttype"]:{name:"Content Type",operator:"cn", type:"refine", indexField:"datasourceodcontenttypes", equalityOperator: " exact "},
["compatibility"]:{name:"Compatibility Level",operator:"cm", type:"vocabulary", indexField:"datasourcecompatibilityid", equalityOperator: " exact "},
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["type","compatibility"];
@ -79,28 +79,28 @@ export class SearchFields {
//DATASET
public DATASET_INDEX:string[] = ["instancetypenameid", "resultlanguageid", //"communityid",
"relfunderid", "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense","resulthostingdatasourceid","collectedfromdatasourceid"];
"resultacceptanceyear","resultbestlicenseid","resulthostingdatasourceid","collectedfromdatasourceid"];
public ADVANCED_SEARCH_DATASET_PARAM:string[] = ["q","title","author","publisher","type", "lang", "funder", "funderlv0",
"funderlv1","funderlv2","community","access","hostedBy","collectedFrom"];
public DATASET_INDEX_PARAM_MAP:{ [key:string]:string } = {["instancetypenameid"]:"type", ["resultlanguageid"]:"lang",["communityid"]:"community",
[ "relfunderid"]:"funder",
["relfundinglevel0_id"]:"funderlv0",["relfundinglevel1_id"]:"funderlv1",["relfundinglevel2_id"]:"funderlv2",
["resultacceptanceyear"]:"year",["resultbestlicense"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"};
public DATASET_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle"},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson"},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher"},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid"},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id"},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id"},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id"},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypenameid"},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguageid"},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid"},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicense'},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid"},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid"}
["resultacceptanceyear"]:"year",["resultbestlicenseid"]:"access",["resulthostingdatasourceid"]:"hostedBy",["collectedfromdatasourceid"]:"collectedFrom"};
public DATASET_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["title"]:{name:"Title",operator:"tt", type:"keyword" , indexField:"resulttitle", equalityOperator: "="},
["author"]:{name:"Author",operator:"at", type:"keyword", indexField:"relperson", equalityOperator: "="},
["publisher"]:{name:"Publisher",operator:"pb", type:"keyword", indexField:"resultpublisher", equalityOperator: "="},
["funder"]:{name:"Funder",operator:"fn", type:"refine", indexField:"relfunderid", equalityOperator: " exact "},
["funderlv0"]:{name:"Funding Stream",operator:"fn0", type:"refine", indexField:"relfundinglevel0_id", equalityOperator: " exact "},
["funderlv1"]:{name:"Funding Substream Level 1",operator:"fn1", type:"refine", indexField:"relfundinglevel1_id", equalityOperator: " exact "},
["funderlv2"]:{name:"Funding Substream Level 2",operator:"fn2", type:"refine", indexField:"relfundinglevel2_id", equalityOperator: " exact "},
["type"]:{name:"Type",operator:"tp", type:"vocabulary", indexField:"instancetypenameid", equalityOperator: " exact "},
["lang"]: {name:"Language",operator:"ln", type:"vocabulary", indexField:"resultlanguageid", equalityOperator: " exact "},
["community"]: {name:"Community",operator:"cm", type:"refine", indexField:"communityid", equalityOperator: " exact "},
["access"]: {name:"Access Mode",operator:"ac", type:"vocabulary", indexField:'resultbestlicenseid', equalityOperator: " exact "},
["hostedBy"]: {name:"Hosted by data provider",operator:"hs", type:"refine", indexField:"resulthostingdatasourceid", equalityOperator: " exact "},
["collectedFrom"]: {name:"Collected from data provider",operator:"cl", type:"refine", indexField:"collectedfromdatasourceid", equalityOperator: " exact "}
};
@ -109,12 +109,12 @@ export class SearchFields {
public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
["organizationcountryid"]:"country",["organizationeclegalbody"]:"type"};
public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname"},
["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname"},
["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryid"},
["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody"},
public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryid", equalityOperator: " exact "},
["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
};
@ -125,13 +125,11 @@ export class SearchFields {
public ADVANCED_SEARCH_PERSON_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
public PERSON_INDEX_PARAM_MAP:{ [key:string]:string } = {["personsecondnames"]:"surname", ["personfirstname"]:"name",
["personfullname"]:"fullname"};
public PERSON_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null},
["surname"]:{name:"Surname",operator:"sr", type:"keyword" , indexField:"personsecondnames"},
["name"]:{name:"Name",operator:"nm", type:"keyword", indexField:"personfirstname"},
["fullname"]:{name:"Full name",operator:"fl", type:"keyword", indexField:"personfullname"}};
public PERSON_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }} ={
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
["surname"]:{name:"Surname",operator:"sr", type:"keyword" , indexField:"personsecondnames", equalityOperator: "="},
["name"]:{name:"Name",operator:"nm", type:"keyword", indexField:"personfirstname", equalityOperator: "="},
["fullname"]:{name:"Full name",operator:"fl", type:"keyword", indexField:"personfullname", equalityOperator: "="}};
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
@ -147,7 +145,7 @@ export class SearchFields {
["fundinglevel1_id"]:"Funding Substream Level 1", ["fundinglevel2_id"]:"Funding Substream Level 2", ["relfunderid"]:"Funder",
["relfundinglevel0_id"]:"Funding Stream",["relfundinglevel1_id"]:"Funding Substream Level 1", ["relfundinglevel2_id"]:"Funding Substream Level 2",
["instancetypenameid"]:"Type",["resultlanguageid"]: "Language",["communityid"]: "Context",["resultacceptanceyear"]:"Year",
["resultbestlicense"]:"Access Mode",["resulthostingdatasourceid"]:"Hosting Data provider",
["resultbestlicenseid"]:"Access Mode",["resulthostingdatasourceid"]:"Hosting Data provider",
["collectedfromdatasourceid"]:"Collected from", ["datasourcetypeuiid"]:"Compatibility Type", ["datasourceodlanguages"]:"Language",
["datasourceodcontenttypes"]: "Type", ["datasourcecompatibilityid"]:"Compatibility Type", ["organizationcountryid"]:"Country",
["organizationeclegalbody"]:"Type",["projectstartyear"]:"Start Year",["projectendyear"]:"End Year",["projectecsc39"]:"Special Clause 39"};

View File

@ -19,10 +19,12 @@ export function getLRU(lru?: any) {
return lru || new Map();
}
export function getRequest() {
return Zone.current.get('req') || {};
// the request object only lives on the server
return { cookie: document.cookie };
}
export function getResponse() {
return Zone.current.get('res') || {};
// the response object is sent as the index.html and lives on the server
return {};
}
@ -32,6 +34,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
@NgModule({
bootstrap: [ AppComponent ],
imports: [
// MaterialModule.forRoot() should be included first
UniversalModule, // BrowserModule, HttpModule, and JsonpModule are included
FormsModule,

View File

@ -22,11 +22,11 @@ export const platformRef = platformBrowser();
export function main() {
// Load fonts async
// https://github.com/typekit/webfontloader#configuration
loadWebFont({
google: {
families: ['Droid Sans']
}
});
// loadWebFont({
// google: {
// families: ['Droid Sans']
// }
// });
return platformRef.bootstrapModuleFactory(MainModuleNgFactory);
}

View File

@ -10,7 +10,7 @@ import { platformUniversalDynamic } from 'angular2-universal/browser';
import { load as loadWebFont } from 'webfontloader';
// enable prod for faster renders
// enableProdMode();
enableProdMode();
import { MainModule } from './browser.module';
@ -20,11 +20,11 @@ export const platformRef = platformUniversalDynamic();
export function main() {
// Load fonts async
// https://github.com/typekit/webfontloader#configuration
loadWebFont({
google: {
families: ['Droid Sans']
}
});
// loadWebFont({
// google: {
// families: ['Droid Sans']
// }
// });
return platformRef.bootstrapModule(MainModule);
}

View File

@ -21,6 +21,7 @@
.searchFilterBox .values {overflow:auto; max-height:200px; }
.selected-filters-box {margin:5px; background-color:#F8F8F8; }
.search-form {margin:5px; }
.clickable { cursor:pointer; }
</style>

View File

@ -15,10 +15,10 @@ export function getLRU() {
return new Map();
}
export function getRequest() {
return {};
return Zone.current.get('req') || {};
}
export function getResponse() {
return {};
return Zone.current.get('res') || {};
}
// TODO(gdi2290): refactor into Universal
@ -27,9 +27,12 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
@NgModule({
bootstrap: [ AppComponent ],
imports: [
// MaterialModule.forRoot() should be included first
UniversalModule, // BrowserModule, HttpModule, and JsonpModule are included
FormsModule,
RouterModule.forRoot([], { useHash: false }),
SharedModule.forRoot(),
AppModule,
],
@ -49,6 +52,7 @@ export const UNIVERSAL_KEY = 'UNIVERSAL_CACHE';
})
export class MainModule {
constructor(public cache: CacheService) {
}
/**

View File

@ -6,11 +6,17 @@ import 'angular2-universal-polyfills';
import 'ts-helpers';
import './__workaround.node'; // temporary until 2.1.1 things are patched in Core
import * as fs from 'fs';
import * as path from 'path';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser';
import * as compression from 'compression';
import * as morgan from 'morgan';
const { gzipSync } = require('zlib');
const accepts = require('accepts');
const { compressSync } = require('iltorb');
const interceptor = require('express-interceptor');
// Angular 2
import { enableProdMode } from '@angular/core';
@ -49,6 +55,13 @@ app.use(cookieParser('Angular 2 Universal'));
app.use(bodyParser.json());
app.use(compression());
const accessLogStream = fs.createWriteStream(ROOT + '/morgan.log', {flags: 'a'})
app.use(morgan('common', {
skip: (req, res) => res.statusCode < 400,
stream: accessLogStream
}));
function cacheControl(req, res, next) {
// instruct browser to revalidate in 60 seconds
res.header('Cache-Control', 'max-age=60');

View File

@ -10,6 +10,7 @@ import * as path from 'path';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser';
import * as morgan from 'morgan';
import * as compression from 'compression';
// Angular 2
@ -48,6 +49,8 @@ app.use(cookieParser('Angular 2 Universal'));
app.use(bodyParser.json());
app.use(compression());
app.use(morgan('dev'));
function cacheControl(req, res, next) {
// instruct browser to revalidate in 60 seconds
res.header('Cache-Control', 'max-age=60');

View File

@ -93,7 +93,7 @@ export var serverConfig = {
__dirname: true,
__filename: true,
process: true,
Buffer: false
Buffer: true
}
};

View File

@ -1,18 +1,21 @@
var webpack = require('webpack');
var path = require('path');
var clone = require('js.clone');
var webpackMerge = require('webpack-merge');
var V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const clone = require('js.clone');
const webpackMerge = require('webpack-merge');
const V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
import webpackConfig, { root, includeClientPackages } from './webpack.config';
// var CompressionPlugin = require('compression-webpack-plugin');
// const CompressionPlugin = require('compression-webpack-plugin');
export var commonPlugins = [
export const commonPlugins = [
new V8LazyParseWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env': {
'NODE_ENV': JSON.stringify('production'),
'AOT': true
}
}),
// Loader options
@ -43,7 +46,7 @@ export var commonPlugins = [
),
];
export var commonConfig = {
export const commonConfig = {
output: {
filename: '[name].bundle.js',
chunkFilename: '[chunkhash].js'
@ -51,7 +54,7 @@ export var commonConfig = {
};
// Client.
export var clientPlugins = [
export const clientPlugins = [
new BundleAnalyzerPlugin({
analyzerMode: 'disabled', // change it to `server` to view bundle stats
reportFilename: 'report.html',
@ -87,7 +90,8 @@ export var clientPlugins = [
if_return: true,
join_vars: true,
negate_iife: false // we need this for lazy v8
}
},
sourceMap: true
}),
new webpack.NormalModuleReplacementPlugin(
@ -127,19 +131,41 @@ export var clientPlugins = [
// }),
];
export var clientConfig = {
export const clientConfig = {
entry: './src/client.aot',
recordsOutputPath: root('webpack.records.json')
};
// Server.
export var serverPlugins = [
export const serverPlugins = [
new webpack.optimize.UglifyJsPlugin({
// beautify: true,
mangle: false, // to ensure process.env still works
output: {
comments: false
},
compress: {
warnings: false,
conditionals: true,
unused: true,
comparisons: true,
sequences: true,
dead_code: true,
evaluate: true,
if_return: true,
join_vars: true,
negate_iife: false // we need this for lazy v8
},
sourceMap: true
}),
];
export var serverConfig = {
export const serverConfig = {
entry: './src/server.aot',
output: {
filename: 'index.js'
filename: 'index.js',
chunkFilename: '[id].bundle.js',
crossOriginLoading: false
},
};