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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: ` template: `
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters" <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)" > [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
</search-page> </search-page>
@ -26,7 +26,6 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchEntityRegistriesComponent { export class SearchEntityRegistriesComponent {
public results =[]; public results =[];
private filters =[]; private filters =[];
public totalResults:number = 0 ;
private baseUrl:string; private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass(); private searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private subResults: any; private sub: any; private subResults: any;
@ -34,7 +33,7 @@ export class SearchEntityRegistriesComponent {
private searchFields:SearchFields = new SearchFields(); private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX; private refineFields: string[] = this.searchFields.DATAPROVIDER_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.DATAPROVIDER_INDEX_PARAM_MAP; 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[]}[] =[ private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[
{field:"type",opName:"tp",opValue:"and",values: ["other"]}]; {field:"type",opName:"tp",opValue:"and",values: ["other"]}];
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}]; // ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
@ -79,14 +78,14 @@ export class SearchEntityRegistriesComponent {
private _getResults(parameters:string,refine:boolean, page: number, size: number){ private _getResults(parameters:string,refine:boolean, page: number, size: number){
this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe( this.subResults = this._searchDataprovidersService.searchEntityRegistries(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, []).subscribe(
data => { data => {
this.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]"); console.info("search Entity Registries: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1]; this.results = data[1];
this.searchPage.checkSelectedFilters(this.filters); this.searchPage.checkSelectedFilters(this.filters);
this.searchPage.updateBaseUrlWithParameters(this.filters); this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes(); var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE; this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){ if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE; this.searchUtils.status = errorCodes.NONE;
} }
}, },

View File

@ -38,58 +38,58 @@ import {OpenaireProperties} from '../../utils/properties/openaireProperties';
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li (click)="searchPublications()"> <li (click)="searchPublications()">
<a data-toggle="tab" href="#pubsTab"> <a data-toggle="tab" href="#pubsTab">
Publications ({{searchPublicationsComponent.totalResults}}) Publications ({{searchPublicationsComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
<li (click)="searchDatasets()"> <li (click)="searchDatasets()">
<a data-toggle="tab" href="#dataTab"> <a data-toggle="tab" href="#dataTab">
Datasets ({{searchDatasetsComponent.totalResults}}) Datasets ({{searchDatasetsComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
<li (click)="searchProjects()"> <li (click)="searchProjects()">
<a data-toggle="tab" href="#projectsTab"> <a data-toggle="tab" href="#projectsTab">
Projects ({{searchProjectsComponent.totalResults}}) Projects ({{searchProjectsComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
<li (click)="searchDataProviders()"> <li (click)="searchDataProviders()">
<a data-toggle="tab" href="#dataProviderTab"> <a data-toggle="tab" href="#dataProviderTab">
Data Providers ({{searchDataProvidersComponent.totalResults}}) Data Providers ({{searchDataProvidersComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
<li (click)="searchOrganizations()"> <li (click)="searchOrganizations()">
<a data-toggle="tab" href="#organizationsTab" > <a data-toggle="tab" href="#organizationsTab" >
Organizations ({{searchOrganizationsComponent.totalResults}}) Organizations ({{searchOrganizationsComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
<li (click)="searchPeople()"> <li (click)="searchPeople()">
<a data-toggle="tab" href="#peopleTab" > <a data-toggle="tab" href="#peopleTab" >
People ({{searchPeopleComponent.totalResults}}) People ({{searchPeopleComponent.searchUtils.totalResults}})
</a> </a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="pubsTab" class="tab-pane fade in active panel-body"> <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> <search-result [(results)]="searchPublicationsComponent.results" [(status)]= "searchPublicationsComponent.status"></search-result>
</div> </div>
<div id="dataTab" class="tab-pane fade in panel-body" > <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> <search-result [(results)]="searchDatasetsComponent.results" [(status)]= "searchDatasetsComponent.status"></search-result>
</div> </div>
<div id="projectsTab" class="tab-pane fade in panel-body" > <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> <search-result [(results)]="searchProjectsComponent.results" [(status)]= "searchProjectsComponent.status"></search-result>
</div> </div>
<div id="dataProviderTab" class="tab-pane fade in panel-body" > <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> <search-result [(results)]="searchDataProvidersComponent.results" [(status)]= "searchDataProvidersComponent.status"></search-result>
</div> </div>
<div id="organizationsTab" class="tab-pane fade in panel-body" > <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> <search-result [(results)]="searchOrganizationsComponent.results" [(status)]= "searchOrganizationsComponent.status"></search-result>
</div> </div>
<div id="peopleTab" class="tab-pane fade in panel-body" > <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> <search-result [(results)]="searchPeopleComponent.results" [(status)]= "searchPeopleComponent.status"></search-result>
</div> </div>
</div> </div>
@ -280,7 +280,7 @@ private subPub;private subData;private subProjects;private subOrg;private subPeo
this.subPublicationsCount = this.route.queryParams.subscribe(params => { this.subPublicationsCount = this.route.queryParams.subscribe(params => {
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe( this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
data => { data => {
this.searchPublicationsComponent.totalResults = data; this.searchPublicationsComponent.searchUtils.totalResults = data;
}, },
err => { err => {
console.error(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.subDatasetsCount = this.route.queryParams.subscribe(params => {
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe( this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe(
data => { data => {
this.searchDatasetsComponent.totalResults = data; this.searchDatasetsComponent.searchUtils.totalResults = data;
}, },
err => { err => {
console.error(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.subProjectsCount = this.route.queryParams.subscribe(params => {
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe( this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe(
data => { data => {
this.searchProjectsComponent.totalResults = data; this.searchProjectsComponent.searchUtils.totalResults = data;
}, },
err => { err => {
console.error(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.subOrganizationsCount = this.route.queryParams.subscribe(params => {
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe( this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
data => { data => {
this.searchOrganizationsComponent.totalResults = data; this.searchOrganizationsComponent.searchUtils.totalResults = data;
}, },
err => { err => {
console.error(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.subPeopleCount = this.route.queryParams.subscribe(params => {
this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe( this.subPeople = this._searchPeopleService.numOfSearchPeople(this.keyword).subscribe(
data => { data => {
this.searchPeopleComponent.totalResults = data; this.searchPeopleComponent.searchUtils.totalResults = data;
}, },
err => { err => {
console.error(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"> <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>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'refine'" class="input-group"> <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>
<div *ngIf = "fieldIdsMap[selectedField.id].type == 'boolean'" class="input-group"> <div *ngIf = "fieldIdsMap[selectedField.id].type == 'boolean'" class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
@ -87,7 +87,7 @@ import {SearchFields} from '../../utils/properties/searchFields';
export class AdvancedSearchFormComponent { export class AdvancedSearchFormComponent {
@Input() entityType; @Input() entityType;
@Input() fieldIds: string[]; @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() selectedFields:AdvancedField[];
@Output() queryChange = new EventEmitter(); @Output() queryChange = new EventEmitter();
newFieldId:string; newFieldId:string;

View File

@ -36,7 +36,7 @@ import {SearchUtilsClass} from './searchUtils.class';
(queryChange)="queryChanged($event)"> (queryChange)="queryChanged($event)">
</advanced-search-form> </advanced-search-form>
<!--div class="text-right" *ngIf="results && results.length>= size"--> <!--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-->
<div> <div>
@ -54,11 +54,11 @@ export class AdvancedSearchPageComponent {
@Input() results = []; @Input() results = [];
@Input() entityType; @Input() entityType;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass(); @Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0; // @Input() totalResults: number = 0;
@Input() fieldIds: string[]; @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() selectedFields:AdvancedField[];
@Input() baseUrl:string = ''; // @Input() baseUrl:string = '';
@Input() simpleSearchUrl: string; @Input() simpleSearchUrl: string;
private baseURLWithParameters:string = ''; private baseURLWithParameters:string = '';
@ -72,9 +72,9 @@ export class AdvancedSearchPageComponent {
} }
ngOnInit() { ngOnInit() {
console.log("Init: AdvancedSearchPageComponent"); console.log("Init: AdvancedSearchPageComponent"+this.searchUtils.totalResults+this.searchUtils.baseUrl);
this.updateBaseUrlWithParameters();
this.totalResults = this.results.length; // this.searchUtils.totalResults = this.results.length;
} }
public getSelectedFiltersFromUrl(params){ public getSelectedFiltersFromUrl(params){
for(var i=0; i< this.fieldIds.length ; i++){ for(var i=0; i< this.fieldIds.length ; i++){
@ -126,11 +126,16 @@ export class AdvancedSearchPageComponent {
public createQueryParameters(){ public createQueryParameters(){
var params=""; var params="";
for(var i = 0; i< this.selectedFields.length; i++){ 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 != ""){ if(this.fieldIdsMap[this.selectedFields[i].id] != undefined && this.selectedFields[i].value != ""){
params +="&"+ this.selectedFields[i].id if(this.selectedFields[i].id == "q"){
+ "="+ encodeURIComponent(this.selectedFields[i].value)+"&"+this.fieldIdsMap[this.selectedFields[i].id].operator params += (i == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
+ "=" + this.selectedFields[i].operatorId; }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 * Update the url with proper parameters. This is used as base url in Paging Component
*/ */
public updateBaseUrlWithParameters(){ 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="container">
<div class="searchUtils.page-header"> <div class="searchUtils.page-header">
<h1>{{pageTitle}}</h1> <h1>{{pageTitle}} {{type}}</h1>
</div> </div>
<div> <div>
<div *ngIf="showRefine" class=""> <div *ngIf="showRefine" class="">
@ -22,12 +22,12 @@ import {SearchUtilsClass} from './searchUtils.class';
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form> <search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form>
<div *ngIf="isFiltered()" class = "selected-filters-box"> <div *ngIf="isFiltered()" class = "selected-filters-box">
<span *ngIf = "searchUtils.keyword.length > 0">Keywords: <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>
<span *ngFor="let filter of filters " > <span *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> {{filter.title}}: </span> <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; " > <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 *ngIf="!end">,</span>
</span> </span>
</span> </span>
@ -43,17 +43,17 @@ import {SearchUtilsClass} from './searchUtils.class';
</div> </div>
<div class="col-xs-12 col-sm-9 " > <div class="col-xs-12 col-sm-9 " >
<search-download [totalResults]="totalResults" (downloadClick)="downloadClicked($event)"></search-download> <search-download [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
<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>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result> <search-result [results]="results" [totalResults]="searchUtils.totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="!showRefine" > <div *ngIf="!showRefine" >
<search-form [(keyword)]="searchUtils.keyword" (keywordChange)="keywordChanged($event)"></search-form> <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-paging [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseURLWithParameters"></search-paging>
<search-result [results]="results" [totalResults]="totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result> <search-result [results]="results" [totalResults]="searchUtils.totalResults" [status]=searchUtils.status [page]="searchUtils.page"></search-result>
</div> </div>
</div> </div>
@ -65,9 +65,9 @@ export class SearchPageComponent {
@Input() pageTitle = ""; @Input() pageTitle = "";
@Input() results = []; @Input() results = [];
@Input() filters = []; @Input() filters = [];
@Input() type; @Input() type:string = "";
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass(); @Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() totalResults: number = 0; // @Input() totalResults: number = 0;
@Output() queryChange = new EventEmitter(); @Output() queryChange = new EventEmitter();
@Output() downloadClick = new EventEmitter(); @Output() downloadClick = new EventEmitter();
@Input() baseUrl:string = ''; @Input() baseUrl:string = '';
@ -75,7 +75,7 @@ export class SearchPageComponent {
@Input() showRefine:boolean = true; @Input() showRefine:boolean = true;
@Input() refineFields = []; @Input() refineFields = [];
public indexIdsMap: { [key:string]:string } ; 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 searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>(); private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = ''; private baseURLWithParameters:string = '';
@ -91,8 +91,12 @@ export class SearchPageComponent {
ngAfterViewChecked(){ ngAfterViewChecked(){
} }
public getQueryParametersFromUrl(params){ public getQueryParametersFromUrl(params){
//TODO when final search is done-allFqs/fq
var parameters = ""; var parameters = "";
var allFqs = "";
for(var i=0; i< this.refineFields.length ; i++){ for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i]; var filterId = this.refineFields[i];
@ -103,24 +107,33 @@ export class SearchPageComponent {
} }
this.queryParameters[filterId]=decodeURIComponent(params[filterId]); this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
let values = decodeURIComponent(this.queryParameters[filterId]).split(","); let values = decodeURIComponent(this.queryParameters[filterId]).split(",");
var countvalues = 0 var countvalues = 0;
var fq = "";
for(let value of values) { for(let value of values) {
countvalues++; countvalues++;
var paramId = this.indexIdsMap[filterId]; var paramId = this.indexIdsMap[filterId];
parameters+='&' + paramId+ '='+ value+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or"); 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']; 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){ public getIndexQueryParametersFromUrl(params){
var parameters = ""; var parameters = "";
var allFqs = "";
for(var i=0; i< this.refineFields.length ; i++){ for(var i=0; i< this.refineFields.length ; i++){
var filterId = this.refineFields[i]; var filterId = this.refineFields[i];
var fq = "";
if(params[filterId] != undefined) { if(params[filterId] != undefined) {
if(this.queryParameters == undefined){ if(this.queryParameters == undefined){
this.queryParameters = new Map<string,string>(); this.queryParameters = new Map<string,string>();
@ -131,14 +144,21 @@ export class SearchPageComponent {
for(let value of values) { for(let value of values) {
countvalues++; countvalues++;
parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value; parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + this.quote(value);
} }
parameters+= " ) " parameters+= " ) "
if(countvalues > 0){
fq="&fq="+fq;
} }
allFqs += fq;
}
} }
var keyword = params['keyword']; var keyword = params['keyword'];
parameters += (keyword && keyword.length > 0?' and '+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 * 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[]){ private createSearchQueryParameters(filters:Filter[]){
//TODO when final search is done- remove allLimits/filterLimits and use allFqs/fq
var allLimits=""; var allLimits="";
var allFqs = "";
for (let filter of filters){ for (let filter of filters){
if(filter.countSelectedValues > 0){ if(filter.countSelectedValues > 0){
var filterLimits=""; var filterLimits="";
var fq = "";
var count_selected=0; var count_selected=0;
var fieldId = this.indexIdsMap[filter.filterId]; var fieldId = this.indexIdsMap[filter.filterId];
for (let value of filter.values){ for (let value of filter.values){
if(value.selected == true){ if(value.selected == true){
count_selected++; count_selected++;
filterLimits+='&' + fieldId+ '='+ value.id+"&" + this.fieldIdsMap[fieldId].operator + "="+((count_selected == 1)?"and":filter.filterOperator); 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; allLimits += filterLimits;
allFqs += fq;
} }
} }
//TODO when final search is done- remove op=and from keyword
return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+allLimits; return (this.searchUtils.keyword.length > 0?'q='+this.searchUtils.keyword+"&op=and":'')+(this.type == 'publication'?allFqs:allLimits);
} }
private createIndexQueryParameters(filters:Filter[]){ private createIndexQueryParameters(filters:Filter[]){
//TODO
var allLimits=""; var allLimits="";
var allFqs = "";
for (let filter of filters){ for (let filter of filters){
if(filter.countSelectedValues > 0){ if(filter.countSelectedValues > 0){
var filterLimits=""; var filterLimits="";
var count_selected=0; var count_selected=0;
var fq = "";
var fieldId = this.indexIdsMap[filter.filterId]; var fieldId = this.indexIdsMap[filter.filterId];
for (let value of filter.values){ for (let value of filter.values){
if(value.selected == true){ if(value.selected == true){
count_selected++; count_selected++;
filterLimits+=((count_selected == 1)?" and (":" "+filter.filterOperator+" ") + filter.filterId+ '='+ value.id; 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 )?' ) ':''; filterLimits+=(filterLimits.length > 0 )?' ) ':'';
allLimits += filterLimits; 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(){ private isFiltered(){
@ -305,7 +339,6 @@ export class SearchPageComponent {
} }
filterChanged($event){ filterChanged($event){
console.log("HEEEEERE");
this.goTo(1); this.goTo(1);
} }
keywordChanged($event) { keywordChanged($event) {
@ -380,6 +413,9 @@ export class SearchPageComponent {
} }
return "&refine=true"+fieldsStr; 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', selector: 'search-paging',
template: ` template: `
<div class= "searchPaging"> <div class= "searchPaging">
<div class="text-right" *ngIf="results && totalResults > size"> <div class="text-right" *ngIf="results && searchUtils.totalResults > searchUtils.size">
<paging [currentPage]="page" [totalResults]="totalResults" [baseUrl]="baseUrl" [size]="size"> </paging> <paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" [size]="searchUtils.size"> </paging>
</div> </div>
<div class="text-left" *ngIf="results && totalResults > 0"> <div class="text-left" *ngIf="results && searchUtils.totalResults > 0">
{{totalResults}} documents, page {{page}} of {{(currentPage())}} {{searchUtils.totalResults}} documents, page {{searchUtils.page}} of {{(totalPages())}}
</div> </div>
</div> </div>
` `
}) })
export class SearchPagingComponent { export class SearchPagingComponent {
@Input() page:number = 1; @Input() searchUtils;
@Input() size:number = 1;
@Input() results; @Input() results;
@Input() baseUrl:string = ""; @Input() baseUrl;
@Input() totalResults:number = 0;
// @Input() totalResults:number = 0;
constructor () { constructor () {
} }
@ -28,12 +28,12 @@ export class SearchPagingComponent {
} }
currentPage(): number { totalPages(): number {
let curPage: any = this.totalResults/this.size; let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
if(!(Number.isInteger(curPage))) { if(!(Number.isInteger(totalPages))) {
curPage = (parseInt(curPage, 10) + 1); totalPages = (parseInt(totalPages, 10) + 1);
} }
return curPage; return totalPages;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
template: ` template: `
<search-page pageTitle="Search Projects" type="project" [(filters)] = "filters" <search-page pageTitle="Search Projects" type="project" [(filters)] = "filters"
[(results)] = "results" [(totalResults)] = "totalResults" [(results)] = "results"
[(searchUtils)] = "searchUtils" [(searchUtils)] = "searchUtils"
[baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" > [baseUrl] = "baseUrl" (queryChange)="queryChanged($event)" >
</search-page> </search-page>
@ -24,15 +24,15 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
export class SearchProjectsComponent { export class SearchProjectsComponent {
public results =[]; public results =[];
private filters: Filter[] =[]; private filters: Filter[] =[];
public totalResults:number = 0 ; // public totalResults:number = 0 ;
private baseUrl:string; private baseUrl:string;
private searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();
private sub: any; private sub: any;
private subResults: any; private subResults: any;
private searchFields:SearchFields = new SearchFields(); private searchFields:SearchFields = new SearchFields();
private refineFields: string[] = this.searchFields.PROJECT_INDEX; private refineFields: string[] = this.searchFields.PROJECT_INDEX;
private indexIdsMap: { [key:string]:string } = this.searchFields.PROJECT_INDEX_PARAM_MAP; 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 urlParams : Map<string, string>;
private _location:Location; 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( this.subResults = this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
data => { data => {
this.totalResults = data[0]; this.searchUtils.totalResults = data[0];
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.totalResults+"]"); console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1]; this.results = data[1];
this.filters = data[2]; this.filters = data[2];
this.searchPage.checkSelectedFilters(this.filters); this.searchPage.checkSelectedFilters(this.filters);
@ -98,7 +98,7 @@ export class SearchProjectsComponent {
this.searchPage.updateBaseUrlWithParameters(this.filters); this.searchPage.updateBaseUrlWithParameters(this.filters);
var errorCodes:ErrorCodes = new ErrorCodes(); var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE; this.searchUtils.status = errorCodes.DONE;
if(this.totalResults == 0 ){ if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE; this.searchUtils.status = errorCodes.NONE;
} }
}, },

View File

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

View File

@ -23,7 +23,7 @@ export class SearchDataprovidersService {
if(refineParams!= null && refineParams != '' ) { if(refineParams!= null && refineParams != '' ) {
url += refineParams; url += refineParams;
} }
url += "&page="+page+"&size="+size; url += "&page="+(page)+"&size="+size;
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
@ -37,7 +37,30 @@ export class SearchDataprovidersService {
this._cache.set(key, res); 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 { searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[] ):any {
let url = OpenaireProperties.getSearchResourcesAPIURL(); let url = OpenaireProperties.getSearchResourcesAPIURL();
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" 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 != '' ) { if(refineParams!= null && refineParams != '' ) {
url += refineParams; url += refineParams;
} }
url += "&page="+page+"&size="+size; url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)); return Observable.of(this._cache.get(key));
@ -69,7 +93,8 @@ export class SearchDataprovidersService {
if(refineParams!= null && refineParams != '' ) { if(refineParams!= null && refineParams != '' ) {
url += refineParams; url += refineParams;
} }
url += "&page="+page+"&size="+size; url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
let key = url; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)); return Observable.of(this._cache.get(key));
@ -92,6 +117,9 @@ export class SearchDataprovidersService {
compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)" 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+")"; 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; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
return Observable.of(this._cache.get(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 { searchDatasetsForEntity (params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURL(); let link = OpenaireProperties.getSearchAPIURL();
let url = link+params+"/datasets"; let url = link+params+"/datasets";

View File

@ -24,11 +24,15 @@ export class SearchOrganizationsService {
if(params!= null && params != '' ) { if(params!= null && params != '' ) {
url += "((oaftype exact organization and deletedbyinference=false and "+ 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=*))"+ "(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; let key = url;
if (this._cache.has(key)) { if (this._cache.has(key)) {
@ -99,7 +103,30 @@ export class SearchOrganizationsService {
this._cache.set(key, res); 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[] { parseResults(data: any): SearchResult[] {
let results: SearchResult[] = []; let results: SearchResult[] = [];

View File

@ -41,7 +41,30 @@ export class SearchPeopleService {
this._cache.set(key, res); 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[] { parseResults(data: any): SearchResult[] {
let results: SearchResult[] = []; let results: SearchResult[] = [];

View File

@ -42,7 +42,30 @@ export class SearchProjectsService {
this._cache.set(key, res); 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 { getFunders():any {
let url = OpenaireProperties.getSearchAPIURL()+"projects?refine=true&fields=funderid&size=0"; let url = OpenaireProperties.getSearchAPIURL()+"projects?refine=true&fields=funderid&size=0";
let key = url; let key = url;

View File

@ -18,9 +18,9 @@ export class SearchPublicationsService {
searchPublications (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any { 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 != '' ) { if(params!= null && params != '' ) {
url += 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 { searchPublicationsForEntity (params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURL(); let link = OpenaireProperties.getSearchAPIURL();
let url = link+params+"/publications"; let url = link+params+"/publications";

View File

@ -9,7 +9,7 @@ import {Dates} from '../utils/dates.class';
template: ` template: `
<!--i-frame url="https://google.com" width="30%" height="250"></i-frame--> <!--i-frame url="https://google.com" width="30%" height="250"></i-frame-->
<div style ="width:30%; height:250px;" > <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>
<div style ="width:30%; height:250px;" > <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> <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 searchLinkToOrganizations = "search/find/organizations";
private static searchLinkToPeople = "search/find/people"; private static searchLinkToPeople = "search/find/people";
//Advanced Search pages //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 // 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 static searchAPIURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/"; // private searchAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2.0/api/";
private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"; private static searchAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
private static 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://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
private static searchServiveURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/"; private static searchServiveURL = "http://scoobydoo.di.uoa.gr:8181/dnet-functionality-services-2.0.0-SNAPSHOT/";
@ -99,15 +107,15 @@ export class OpenaireProperties {
public static getLinkToSearchPeople():string{ public static getLinkToSearchPeople():string{
return this.baseSearchLink + this.searchLinkToPeople; return this.baseSearchLink + this.searchLinkToPeople;
} }
//Advanced Search Pages
public static getLinkToSearchAdvancedPublications(){
return this.baseSearchLink + this.searchLinkToAdvancedPublications;
}
// Services - APIs' getters // Services - APIs' getters
public static getSearchAPIURL():string{ public static getSearchAPIURL():string{
return this.searchAPIURL; return this.searchAPIURL;
} }
// Services - APIs' getters
public static getSearchAPIURLLast():string{
return this.searchAPIURLLAst;
}
//query using full query: //query using full query:
// //
public static getSearchResourcesAPIURL():string{ public static getSearchResourcesAPIURL():string{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,11 +6,17 @@ import 'angular2-universal-polyfills';
import 'ts-helpers'; import 'ts-helpers';
import './__workaround.node'; // temporary until 2.1.1 things are patched in Core 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 path from 'path';
import * as express from 'express'; import * as express from 'express';
import * as bodyParser from 'body-parser'; import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-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 // Angular 2
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
@ -49,6 +55,13 @@ app.use(cookieParser('Angular 2 Universal'));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(compression()); 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) { function cacheControl(req, res, next) {
// instruct browser to revalidate in 60 seconds // instruct browser to revalidate in 60 seconds
res.header('Cache-Control', 'max-age=60'); 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 express from 'express';
import * as bodyParser from 'body-parser'; import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser'; import * as cookieParser from 'cookie-parser';
import * as morgan from 'morgan';
import * as compression from 'compression'; import * as compression from 'compression';
// Angular 2 // Angular 2
@ -48,6 +49,8 @@ app.use(cookieParser('Angular 2 Universal'));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(compression()); app.use(compression());
app.use(morgan('dev'));
function cacheControl(req, res, next) { function cacheControl(req, res, next) {
// instruct browser to revalidate in 60 seconds // instruct browser to revalidate in 60 seconds
res.header('Cache-Control', 'max-age=60'); res.header('Cache-Control', 'max-age=60');

View File

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

View File

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