mv utils/dates.class.ts to utils/string-utils.class.ts -> put there utils for Dates,DOIs | check if keywords used in search are dois and then search by doi or keyword
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44797 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
79940e6fb5
commit
70bd195043
|
@ -4,6 +4,7 @@ import { SearchDataciteService } from '../../services/searchDatacite.service';
|
||||||
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
||||||
import {ClaimResult} from '../../utils/entities/claimEntities.class';
|
import {ClaimResult} from '../../utils/entities/claimEntities.class';
|
||||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
|
import{DOI} from '../../utils/string-utils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -111,10 +112,12 @@ export class ClaimDatasetComponent {
|
||||||
|
|
||||||
private todayDate = '';
|
private todayDate = '';
|
||||||
private nextDate = '';
|
private nextDate = '';
|
||||||
|
private DOIs:string[] = [];
|
||||||
|
|
||||||
public search(term: string, size : number, page : number){
|
public search(term: string, size : number, page : number){
|
||||||
|
this.DOIs = DOI.getDOIsFromString(term);
|
||||||
this.searchDatacite(term,10,1);
|
this.searchDatacite(term,10,1);
|
||||||
this.searchOpenaire(term,10,1);
|
this.searchOpenaire(term,10,1);
|
||||||
//TODO add openaire search
|
|
||||||
}
|
}
|
||||||
private searchDatacite (term: string, size : number, page : number) {
|
private searchDatacite (term: string, size : number, page : number) {
|
||||||
this.getDataciteResults(term,size,page);
|
this.getDataciteResults(term,size,page);
|
||||||
|
@ -123,24 +126,44 @@ export class ClaimDatasetComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
private searchOpenaire (term: string, size : number, page : number) {
|
private searchOpenaire (term: string, size : number, page : number) {
|
||||||
this._searchDatasetsService.searchDatasets('q='+term+'&op=and', null, page, size, []).subscribe(
|
if(this.DOIs.length > 0 ){
|
||||||
data => {
|
this.openaireStatus = this.errorCodes.LOADING;
|
||||||
if(data != null) {
|
this._searchDatasetsService.searchDatasetsByDois(this.DOIs, null, page, size, []).subscribe(
|
||||||
this.openairePage=page;
|
data => {
|
||||||
this.openaireResultsNum = data[0];
|
if(data != null) {
|
||||||
this.openaireResults = data[1];
|
this.openairePage=page;
|
||||||
this.openaireStatus = this.errorCodes.DONE;
|
this.openaireResultsNum = data[0];
|
||||||
if(this.openaireResultsNum == 0){
|
this.openaireResults = data[1];
|
||||||
this.openaireStatus = this.errorCodes.NONE;
|
this.openaireStatus = this.errorCodes.DONE;
|
||||||
}
|
if(this.openaireResultsNum == 0){
|
||||||
}
|
this.openaireStatus = this.errorCodes.NONE;
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.error(err.status);
|
|
||||||
this.openaireStatus = this.errorCodes.ERROR;
|
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
this._searchDatasetsService.searchDatasets('q="'+term+'"', null, page, size, []).subscribe(
|
||||||
|
data => {
|
||||||
|
if(data != null) {
|
||||||
|
this.openairePage=page;
|
||||||
|
this.openaireResultsNum = data[0];
|
||||||
|
this.openaireResults = data[1];
|
||||||
|
this.openaireStatus = this.errorCodes.DONE;
|
||||||
|
if(this.openaireResultsNum == 0){
|
||||||
|
this.openaireStatus = this.errorCodes.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
this.warningMessage = "";
|
this.warningMessage = "";
|
||||||
this.infoMessage = "";
|
this.infoMessage = "";
|
||||||
|
|
||||||
|
@ -156,8 +179,8 @@ export class ClaimDatasetComponent {
|
||||||
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err);
|
|
||||||
this.dataciteStatus = this.errorCodes.ERROR;
|
this.dataciteStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<div *ngIf="orcidStatus == errorCodes.LOADING" class="alert alert-info" role="alert">Loading...</div>
|
<div *ngIf="orcidStatus == errorCodes.LOADING" class="alert alert-info" role="alert">Loading...</div>
|
||||||
<div *ngIf="orcidStatus == errorCodes.ERROR" class="alert alert-warning" role="alert">An Error Occured</div>
|
<div *ngIf="orcidStatus == errorCodes.ERROR" class="alert alert-warning" role="alert">An Error Occured</div>
|
||||||
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
|
<div *ngIf="orcidStatus == errorCodes.NOT_AVAILABLE" class="alert alert-danger" role="alert">Service not available</div>
|
||||||
|
<div *ngIf="orcidStatus == errorCodes.NONE" class = "alert alert-info " > No results found </div>
|
||||||
|
|
||||||
<div *ngIf="orcidResultsNum != null" class="panel-body">
|
<div *ngIf="orcidResultsNum != null" class="panel-body">
|
||||||
<div class = "alert alert-warning " > Not the right author? Choose one of these:
|
<div class = "alert alert-warning " > Not the right author? Choose one of these:
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {SearchOrcidService} from '../../services/searchOrcid.service';
|
||||||
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
import {ClaimResult} from '../../utils/entities/claimEntities.class';
|
import {ClaimResult} from '../../utils/entities/claimEntities.class';
|
||||||
|
import{DOI} from '../../utils/string-utils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'claim-publication',
|
selector: 'claim-publication',
|
||||||
|
@ -77,11 +77,12 @@ ngOnDestroy() {
|
||||||
|
|
||||||
todayDate = '';
|
todayDate = '';
|
||||||
nextDate = '';
|
nextDate = '';
|
||||||
|
private DOIs:string[] = [];
|
||||||
|
|
||||||
public search(term: string){
|
public search(term: string){
|
||||||
this.warningMessage = "";
|
this.warningMessage = "";
|
||||||
this.infoMessage = "";
|
this.infoMessage = "";
|
||||||
|
this.DOIs = DOI.getDOIsFromString(term);
|
||||||
this.getCrossrefResults(term, this.size,1);
|
this.getCrossrefResults(term, this.size,1);
|
||||||
this.searchOrcid(term);
|
this.searchOrcid(term);
|
||||||
this.searchOpenaire(term, this.size, 1);
|
this.searchOpenaire(term, this.size, 1);
|
||||||
|
@ -90,8 +91,8 @@ public search(term: string){
|
||||||
|
|
||||||
private getCrossrefResults (term: string, size : number, page : number) {
|
private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
this.crossrefStatus = this.errorCodes.LOADING;
|
this.crossrefStatus = this.errorCodes.LOADING;
|
||||||
if(term.split(' ').length == 1 ){
|
if( this.DOIs.length > 0 ){
|
||||||
this._searchCrossrefService.searchCrossrefByDOI(term).subscribe(
|
this._searchCrossrefService.searchCrossrefByDOIs(this.DOIs).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(data != null) {
|
if(data != null) {
|
||||||
this.crossrefResults = data.items;
|
this.crossrefResults = data.items;
|
||||||
|
@ -164,30 +165,57 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private searchOpenaire(term: string, size : number, page : number) {
|
private searchOpenaire(term: string, size : number, page : number) {
|
||||||
this.openaireStatus = this.errorCodes.LOADING;
|
|
||||||
this._searchPublicationsService.searchPublications('q='+term+'&op=and', null, page, size, []).subscribe(
|
|
||||||
data => {
|
|
||||||
if(data != null) {
|
|
||||||
this.openairePage=page;
|
|
||||||
this.openaireResultsNum = data[0];
|
|
||||||
this.openaireResults = data[1];
|
|
||||||
this.openaireStatus = this.errorCodes.DONE;
|
|
||||||
if(this.openaireResultsNum == 0){
|
|
||||||
this.openaireStatus = this.errorCodes.NONE;
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
this.openaireStatus = this.errorCodes.ERROR;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
console.error(err.status);
|
|
||||||
this.openaireStatus = this.errorCodes.ERROR;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
if(this.DOIs.length > 0 ){
|
||||||
|
this.openaireStatus = this.errorCodes.LOADING;
|
||||||
|
this._searchPublicationsService.searchPublicationsByDois(this.DOIs, null, page, size, []).subscribe(
|
||||||
|
data => {
|
||||||
|
if(data != null) {
|
||||||
|
this.openairePage=page;
|
||||||
|
this.openaireResultsNum = data[0];
|
||||||
|
this.openaireResults = data[1];
|
||||||
|
this.openaireStatus = this.errorCodes.DONE;
|
||||||
|
if(this.openaireResultsNum == 0){
|
||||||
|
this.openaireStatus = this.errorCodes.NONE;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
this.openaireStatus = this.errorCodes.LOADING;
|
||||||
|
this._searchPublicationsService.searchPublications('q="'+term+'"', null, page, size, []).subscribe(
|
||||||
|
data => {
|
||||||
|
if(data != null) {
|
||||||
|
this.openairePage=page;
|
||||||
|
this.openaireResultsNum = data[0];
|
||||||
|
this.openaireResults = data[1];
|
||||||
|
this.openaireStatus = this.errorCodes.DONE;
|
||||||
|
if(this.openaireResultsNum == 0){
|
||||||
|
this.openaireStatus = this.errorCodes.NONE;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.openaireStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private searchOrcid (term: string) {
|
private searchOrcid (term: string) {
|
||||||
|
if(this.DOIs.length > 0){
|
||||||
|
this.orcidStatus = this.errorCodes.NONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.orcidStatus = this.errorCodes.LOADING;
|
this.orcidStatus = this.errorCodes.LOADING;
|
||||||
this.authorIds = new Array<string>();
|
this.authorIds = new Array<string>();
|
||||||
this.authorGivenNames = new Array<string>();
|
this.authorGivenNames = new Array<string>();
|
||||||
|
@ -236,8 +264,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
if(err.status == 404){
|
if(err.status == 404){
|
||||||
this.getOrcidAuthors(term);
|
this.getOrcidAuthors(term);
|
||||||
} else {
|
} else {
|
||||||
console.error(err.status);
|
|
||||||
this.orcidStatus = this.errorCodes.ERROR;
|
this.orcidStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,8 +285,8 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
||||||
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.error(err.status);
|
|
||||||
this.orcidStatus = this.errorCodes.ERROR;
|
this.orcidStatus = this.errorCodes.ERROR;
|
||||||
|
console.error(err.status);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {Component, Input, Output, EventEmitter,ViewChild} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {SearchCrossrefService} from '../../../services/searchCrossref.service';
|
import {SearchCrossrefService} from '../../../services/searchCrossref.service';
|
||||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||||
import {Dates} from '../../../utils/dates.class';
|
import {Dates, DOI} from '../../../utils/string-utils.class';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -100,18 +100,20 @@ export class BulkClaimComponent {
|
||||||
|
|
||||||
this.all++;
|
this.all++;
|
||||||
var id=this.removeDoubleQuotes(values[0]);
|
var id=this.removeDoubleQuotes(values[0]);
|
||||||
var accessMode = (values[1] != undefined) ? this.removeDoubleQuotes(values[1]):"OPEN";
|
if(DOI.isValidDOI(id)){
|
||||||
accessMode = (this.validateAccessMode(accessMode)?accessMode:"OPEN");
|
var accessMode = (values[1] != undefined) ? this.removeDoubleQuotes(values[1]):"OPEN";
|
||||||
var embargoDate =(values[2] != undefined) ? this.removeDoubleQuotes(values[2]):Dates.getDateToday();
|
accessMode = (this.validateAccessMode(accessMode)?accessMode:"OPEN");
|
||||||
embargoDate = (Dates.isValidDate(embargoDate)?embargoDate:Dates.getDateToday());
|
var embargoDate =(values[2] != undefined) ? this.removeDoubleQuotes(values[2]):Dates.getDateToday();
|
||||||
if(this.allIds.indexOf(id)>-1){
|
embargoDate = (Dates.isValidDate(embargoDate)?embargoDate:Dates.getDateToday());
|
||||||
this.duplicate++;
|
if(this.allIds.indexOf(id)>-1){
|
||||||
this.duplicateIds.push(id);
|
this.duplicate++;
|
||||||
}else{
|
this.duplicateIds.push(id);
|
||||||
this.allIds.push(id);
|
}else{
|
||||||
this.fetchResult(id,accessMode,embargoDate);
|
this.allIds.push(id);
|
||||||
}
|
this.fetchResult(id,accessMode,embargoDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +169,7 @@ export class BulkClaimComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchResult(id:string,accessMode:string,date:string){
|
fetchResult(id:string,accessMode:string,date:string){
|
||||||
this._searchCrossrefService.searchCrossrefByDOI(id).subscribe(
|
this._searchCrossrefService.searchCrossrefByDOIs([id]).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
|
||||||
var crossrefResult = data.items[0];
|
var crossrefResult = data.items[0];
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Filter, Value} from './searchHelperClasses.class';
|
||||||
import {SearchResult} from '../../utils/entities/searchResult';
|
import {SearchResult} from '../../utils/entities/searchResult';
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchUtilsClass} from './searchUtils.class';
|
import {SearchUtilsClass} from './searchUtils.class';
|
||||||
|
import {DOI} from '../../utils/string-utils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-page',
|
selector: 'search-page',
|
||||||
|
@ -125,9 +126,25 @@ export class SearchPageComponent {
|
||||||
}
|
}
|
||||||
var keyword = params['keyword'];
|
var keyword = params['keyword'];
|
||||||
console.info("Type:" + this.type + "filters: "+allFqs);
|
console.info("Type:" + this.type + "filters: "+allFqs);
|
||||||
var doiQuery =(keyword && keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':"";
|
var doiQuery = "";
|
||||||
var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(keyword) + ")" + doiQuery + ")":this.quote(keyword);
|
var keywordQuery = "";
|
||||||
return (keyword && keyword.length > 0?'q='+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+"&op=and":'') + allFqs;
|
if((keyword && keyword.length > 0)){
|
||||||
|
if((this.type == 'publication' ||this.type == 'dataset')){
|
||||||
|
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
doiQuery += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
keywordQuery += "q=("+this.quote(keyword) +")"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||||
}
|
}
|
||||||
public getIndexQueryParametersFromUrl(params){
|
public getIndexQueryParametersFromUrl(params){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
|
@ -157,12 +174,26 @@ export class SearchPageComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
var keyword = params['keyword'];
|
var keyword = params['keyword'];
|
||||||
var doiQuery =(keyword && keyword.length > 0 && keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ keyword+'"))':"";
|
var doiQuery = "";
|
||||||
var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(keyword) + ")" + doiQuery + ")":this.quote(keyword);
|
var keywordQuery = "";
|
||||||
// parameters += (keyword && keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:keyword)+' ':'');
|
if((keyword && keyword.length > 0)){
|
||||||
// allFqs += ;
|
if((this.type == 'publication' ||this.type == 'dataset')){
|
||||||
|
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
doiQuery += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
keywordQuery += "q=("+this.quote(keyword) +")"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||||
|
|
||||||
return (keyword && keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery: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
|
||||||
|
@ -227,64 +258,81 @@ export class SearchPageComponent {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private createSearchQueryParameters(filters:Filter[]){
|
private createSearchQueryParameters(filters:Filter[]){
|
||||||
// var allLimits="";
|
|
||||||
var allFqs = "";
|
var allFqs = "";
|
||||||
for (let filter of filters){
|
for (let filter of filters){
|
||||||
if(filter.countSelectedValues > 0){
|
if(filter.countSelectedValues > 0){
|
||||||
// var filterLimits="";
|
|
||||||
var fq = "";
|
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);
|
|
||||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
|
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fq="&fq="+fq;
|
fq="&fq="+fq;
|
||||||
// allLimits += filterLimits;
|
|
||||||
allFqs += fq;
|
allFqs += fq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO when final search is done- remove op=and from keyword
|
var doiQuery = "";
|
||||||
var doiQuery =(this.searchUtils.keyword.length > 0 && this.searchUtils.keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ this.searchUtils.keyword+'"))':"";
|
var keywordQuery = "";
|
||||||
var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(this.searchUtils.keyword) + ")" + doiQuery + ")":this.quote(this.searchUtils.keyword);
|
if((this.searchUtils.keyword && this.searchUtils.keyword.length > 0)){
|
||||||
return (this.searchUtils.keyword.length > 0?'q='+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:this.searchUtils.keyword)+"&op=and":'')+allFqs;
|
if((this.type == 'publication' ||this.type == 'dataset')){
|
||||||
|
var DOIs:string[] = DOI.getDOIsFromString(this.searchUtils.keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
doiQuery += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
keywordQuery += "q=("+this.quote(this.searchUtils.keyword) +")"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||||
|
|
||||||
}
|
}
|
||||||
private createIndexQueryParameters(filters:Filter[]){
|
private createIndexQueryParameters(filters:Filter[]){
|
||||||
//TODO
|
|
||||||
// var allLimits="";
|
|
||||||
var allFqs = "";
|
var allFqs = "";
|
||||||
for (let filter of filters){
|
for (let filter of filters){
|
||||||
if(filter.countSelectedValues > 0){
|
if(filter.countSelectedValues > 0){
|
||||||
// var filterLimits="";
|
|
||||||
var count_selected=0;
|
var count_selected=0;
|
||||||
var fq = "";
|
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;
|
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
|
||||||
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// filterLimits+=(filterLimits.length > 0 )?' ) ':'';
|
|
||||||
// allLimits += filterLimits;
|
|
||||||
if(count_selected > 0){
|
if(count_selected > 0){
|
||||||
fq="&fq="+fq;
|
fq="&fq="+fq;
|
||||||
allFqs += fq;
|
allFqs += fq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// allLimits += (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+this.searchUtils.keyword+' ':'');
|
var doiQuery = "";
|
||||||
var doiQuery =(this.searchUtils.keyword.length > 0 && this.searchUtils.keyword.split(" ").length ==1 )?'or ((pidclassid exact doi) and (pid exact "'+ this.searchUtils.keyword+'"))':"";
|
var keywordQuery = "";
|
||||||
var keywordQuery =(doiQuery.length > 0 )? "((" + this.quote(this.searchUtils.keyword) + ")" + doiQuery + ")":this.quote(this.searchUtils.keyword);
|
if((this.searchUtils.keyword && this.searchUtils.keyword.length > 0)){
|
||||||
return (this.searchUtils.keyword && this.searchUtils.keyword.length > 0?' and '+(this.type == 'publication' ||this.type == 'dataset' ?keywordQuery:this.searchUtils.keyword)+' ':'')+allFqs;
|
if((this.type == 'publication' ||this.type == 'dataset')){
|
||||||
|
var DOIs:string[] = DOI.getDOIsFromString(this.searchUtils.keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
doiQuery += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
keywordQuery += "q=("+this.quote(this.searchUtils.keyword) +")"
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
private isFiltered(){
|
private isFiltered(){
|
||||||
var filtered=false;
|
var filtered=false;
|
||||||
for (let filter of this.filters){
|
for (let filter of this.filters){
|
||||||
|
|
|
@ -100,7 +100,7 @@ console.info("PAGE init = "+this.searchUtils.page);
|
||||||
public getNumForSearch(keyword: string) {
|
public getNumForSearch(keyword: string) {
|
||||||
var parameters="datasources/count";
|
var parameters="datasources/count";
|
||||||
if(keyword != "") {
|
if(keyword != "") {
|
||||||
parameters += "?q="+keyword;
|
parameters += "?q="+'"'+keyword+'"';
|
||||||
}
|
}
|
||||||
this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
|
this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -210,7 +210,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
parameters = "q="+'"' + keyword + '"';
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
import {DOI} from '../../utils/string-utils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-datasets',
|
selector: 'search-datasets',
|
||||||
|
@ -148,7 +149,17 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
parameters += "q=("+doisParams+")"
|
||||||
|
}else{
|
||||||
|
parameters = "q="+'"' + keyword + '"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,size);
|
this._getResults(parameters,refine,page,size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class SearchOrganizationsComponent {
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
parameters = "q="+'"' + keyword + '"';
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ export class SearchPeopleComponent {
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
parameters = "q="+'"' + keyword + '"';
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class SearchProjectsComponent {
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
parameters = "q="+'"' + keyword + '"';
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
||||||
import {ExportCSVComponent} from '../../utils/exportCSV.component';
|
import {ExportCSVComponent} from '../../utils/exportCSV.component';
|
||||||
|
import {DOI} from '../../utils/string-utils.class';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-publications',
|
selector: 'search-publications',
|
||||||
|
@ -177,7 +178,17 @@ public getResultsForDataproviders(id:string, resultsFrom:string, page: number, s
|
||||||
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
public getResults(keyword:string,refine:boolean, page: number, size: number){
|
||||||
var parameters = "";
|
var parameters = "";
|
||||||
if(keyword.length > 0){
|
if(keyword.length > 0){
|
||||||
parameters = "q=" + keyword + "&op=and";
|
var DOIs:string[] = DOI.getDOIsFromString(keyword);
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
parameters += "q=("+doisParams+")"
|
||||||
|
}else{
|
||||||
|
parameters = "q="+'"' + keyword + '"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._getResults(parameters,refine,page,size);
|
this._getResults(parameters,refine,page,size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,18 @@ export class SearchCrossrefService {
|
||||||
//.catch(this.handleError);
|
//.catch(this.handleError);
|
||||||
|
|
||||||
}
|
}
|
||||||
searchCrossrefByDOI(doi: string):any {
|
searchCrossrefByDOIs(DOIs: string[]):any {
|
||||||
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter=doi:'+doi;
|
/*
|
||||||
|
$request ="http://api.crossref.org/works"."?filter=";
|
||||||
|
foreach($dois as $doi){
|
||||||
|
$request.="doi:".urlencode( trim($doi)).",";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
var doisParams = "";
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?",":"")+'doi:'+DOIs[i];
|
||||||
|
}
|
||||||
|
let url = OpenaireProperties.getSearchCrossrefAPIURL()+'?filter='+doisParams;
|
||||||
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));
|
||||||
|
@ -36,7 +46,7 @@ export class SearchCrossrefService {
|
||||||
|
|
||||||
return this.http.get( url)
|
return this.http.get( url)
|
||||||
.map(request => <any> request.json().message)
|
.map(request => <any> request.json().message)
|
||||||
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doi))
|
.do(items => console.log("Crossref Results: total results = "+items['total-results']+" for doi = "+doisParams))
|
||||||
.do(res => {
|
.do(res => {
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,34 @@ export class SearchDatasetsService {
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
searchDatasetsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||||
|
let link = OpenaireProperties.getSearchAPIURLLast()+"datasets";
|
||||||
|
let url = link+"?";
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
url += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+ (page-1) +"&size="+size+"&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']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
|
||||||
|
.do(res => {
|
||||||
|
this._cache.set(key, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
advancedSearchDatasets (params: string, page: number, size: number ):any {
|
advancedSearchDatasets (params: string, page: number, size: number ):any {
|
||||||
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
var basicQuery = "(oaftype exact result) and (resulttypeid exact dataset) "
|
var basicQuery = "(oaftype exact result) and (resulttypeid exact dataset) "
|
||||||
|
@ -225,7 +252,7 @@ export class SearchDatasetsService {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
||||||
let url = OpenaireProperties.getSearchAPIURLLast()+"datasets/count?q="+params+"&format=json";
|
let url = OpenaireProperties.getSearchAPIURLLast()+"datasets/count?q="+'"' + params + '"'+"&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));
|
||||||
|
|
|
@ -226,7 +226,7 @@ export class SearchOrganizationsService {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
||||||
let url = OpenaireProperties.getSearchAPIURLLast()+"organizations/count?q="+params+ "&format=json";
|
let url = OpenaireProperties.getSearchAPIURLLast()+"organizations/count?q="+'"' + params + '"'+ "&format=json";
|
||||||
|
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class SearchPeopleService {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
||||||
let url = OpenaireProperties.getSearchAPIURLLast()+"people/count?q="+params+ "&format=json";
|
let url = OpenaireProperties.getSearchAPIURLLast()+"people/count?q="+'"' + params + '"'+ "&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));
|
||||||
|
|
|
@ -225,7 +225,7 @@ export class SearchProjectsService {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
||||||
let url = OpenaireProperties.getSearchAPIURLLast()+"projects/count?q="+params+ "&format=json";
|
let url = OpenaireProperties.getSearchAPIURLLast()+"projects/count?q="+'"' + params + '"'+ "&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));
|
||||||
|
|
|
@ -15,7 +15,6 @@ export class SearchPublicationsService {
|
||||||
private sizeOfDescription: number = 497;
|
private sizeOfDescription: number = 497;
|
||||||
|
|
||||||
constructor(private http: Http, public _cache: CacheService) {}
|
constructor(private http: Http, public _cache: CacheService) {}
|
||||||
|
|
||||||
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.getSearchAPIURLLast()+"publications";
|
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
|
||||||
|
@ -43,6 +42,38 @@ export class SearchPublicationsService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchPublicationsByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any {
|
||||||
|
|
||||||
|
let link = OpenaireProperties.getSearchAPIURLLast()+"publications";
|
||||||
|
|
||||||
|
let url = link+"?"+"&format=json&";
|
||||||
|
var doisParams = "";
|
||||||
|
|
||||||
|
for(var i =0 ;i < DOIs.length; i++){
|
||||||
|
doisParams+=(doisParams.length > 0?" or ":"")+'((pidclassid exact doi) and (pid exact "'+ DOIs[i]+'"))';
|
||||||
|
}
|
||||||
|
if(doisParams.length > 0){
|
||||||
|
url += "q=("+doisParams+")"
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
|
||||||
|
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']),RefineResultsUtils.parse(res['refineResults'],refineFields)])
|
||||||
|
.do(res => {
|
||||||
|
this._cache.set(key, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
advancedSearchPublications (params: string, page: number, size: number ):any {
|
advancedSearchPublications (params: string, page: number, size: number ):any {
|
||||||
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
var basicQuery = "(oaftype exact result) and (resulttypeid exact publication) ";
|
var basicQuery = "(oaftype exact result) and (resulttypeid exact publication) ";
|
||||||
|
@ -340,7 +371,7 @@ export class SearchPublicationsService {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
||||||
let url = OpenaireProperties.getSearchAPIURLLast()+"publications/count?q="+params+ "&format=json";
|
let url = OpenaireProperties.getSearchAPIURLLast()+"publications/count?q="+ '"' + params + '"' +"&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));
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {SearchPublicationsService} from '../services/searchPublications.service'
|
||||||
import {SearchDatasetsService} from '../services/searchDatasets.service';
|
import {SearchDatasetsService} from '../services/searchDatasets.service';
|
||||||
|
|
||||||
import {ISVocabulariesService} from '../services/ISVocabularies.service';
|
import {ISVocabulariesService} from '../services/ISVocabularies.service';
|
||||||
import {Dates} from '../utils/dates.class';
|
import {Dates} from '../utils/string-utils.class';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'test',
|
selector: 'test',
|
||||||
template: `
|
template: `
|
||||||
|
@ -17,7 +17,7 @@ import {Dates} from '../utils/dates.class';
|
||||||
<!--static-autocomplete [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete-->
|
<!--static-autocomplete [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete-->
|
||||||
<div>
|
<div>
|
||||||
<div style ="width:30%; height:250px;" >
|
<div style ="width:30%; height:250px;" >
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
Selected::
|
Selected::
|
||||||
<span class="row-fluid show-grid auto-complete-choice" *ngFor="let item of selected" >
|
<span class="row-fluid show-grid auto-complete-choice" *ngFor="let item of selected" >
|
||||||
|
|
|
@ -33,3 +33,29 @@ export class Dates {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class DOI{
|
||||||
|
|
||||||
|
public static getDOIsFromString(str:string):string[]{
|
||||||
|
var DOIs:string[] = [];
|
||||||
|
var words:string[] = str.split(" ");
|
||||||
|
|
||||||
|
for(var i=0; i< words.length; i++){
|
||||||
|
if(DOI.isValidDOI(words[i]) && DOIs.indexOf(words[i]) == -1){
|
||||||
|
DOIs.push(words[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DOIs;
|
||||||
|
}
|
||||||
|
public static isValidDOI(str:string):boolean{
|
||||||
|
|
||||||
|
var exp1 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g
|
||||||
|
var exp2 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])[[:graph:]])+)\b/g
|
||||||
|
if(str.match(exp1)!=null || str.match(exp2)!=null){
|
||||||
|
// console.log("It's a DOI");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue