Change fields with new refine fields from beta DMF | add quoted in parametres in order to work with strange characters

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@45830 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2017-02-10 10:24:59 +00:00
parent e2c0915f34
commit aedb2dac70
14 changed files with 114 additions and 69 deletions

View File

@ -3,7 +3,7 @@ import {Component} from '@angular/core';
@Component({
selector: 'deposit-datasets',
template: `
<deposit [compatibility]="'Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit>
<deposit [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit>
`
})

View File

@ -3,7 +3,7 @@ import {Component} from '@angular/core';
@Component({
selector: 'deposit-datasets-result',
template: `
<deposit-result [compatibility]="'Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit-result>
<deposit-result [compatibility]="'openaire____::21f8a223b9925c2f87c404096080b046||Registry of Research Data Repository'" [requestFor]="'Research Data'"></deposit-result>
`
})

View File

@ -3,7 +3,7 @@ import {Component} from '@angular/core';
@Component({
selector: 'deposit-publications',
template: `
<deposit [compatibility]="'OpenDOAR'" [requestFor]="'Publications'"></deposit>
<deposit [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit>
<h3>Or locate data provider in map</h3>
<div class="uk-margin-top">
<i-frame [url]="mapUrl"width="100%" height="900"></i-frame>

View File

@ -3,7 +3,7 @@ import {Component} from '@angular/core';
@Component({
selector: 'deposit-publications-result',
template: `
<deposit-result [compatibility]="'OpenDOAR'" [requestFor]="'Publications'"></deposit-result>
<deposit-result [compatibility]="'openaire____::47ce9e9f4fad46e732cff06419ecaabb||OpenDOAR'" [requestFor]="'Publications'"></deposit-result>
`
})

View File

@ -129,7 +129,7 @@ export class SearchCompatibleDataprovidersComponent {
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityid"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
var value_names=[
@ -143,7 +143,8 @@ export class SearchCompatibleDataprovidersComponent {
var value_original_ids=[
["pubsrepository::institutional","pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::thematic","aggregator::pubsrepository::institutional","aggregator::pubsrepository::unknown",
"datarepository::unknown", "aggregator::datarepository", "pubsrepository::journal", "aggregator::pubsrepository::journals", "cris", "pubscatalogue::unknown"],
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];

View File

@ -129,7 +129,7 @@ export class SearchEntityRegistriesComponent {
}
private createFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeid","datasourcecompatibilityid"];
var filter_ids=["datasourcetypename","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
var value_names=[
@ -138,8 +138,10 @@ export class SearchEntityRegistriesComponent {
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
var value_original_ids=[
["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]];
["Funder database","Registry of repositories","Scholarly Comm. Infrastructure","Registry","Information Space","Web Source"],
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){

View File

@ -6,6 +6,7 @@ import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass} from './searchUtils.class';
import {ModalLoading} from '../../utils/modal/loading.component';
import {StringUtils} from '../../utils/string-utils.class';
@Component({
selector: 'advanced-search-page',
@ -78,16 +79,21 @@ export class AdvancedSearchPageComponent {
}
public getSelectedFiltersFromUrl(params){
for(var i=0; i< this.fieldIds.length ; i++){
var fieldId = this.fieldIds[i];
var fieldparam = this.fieldIdsMap[fieldId].param;
var fieldparam = (this.fieldIdsMap[fieldId])?this.fieldIdsMap[fieldId].param:"";
if(!this.fieldIdsMap[fieldId]){
console.error("Field: "+fieldId +" not found in fieldIds map");
}
var operatorId = this.getOperatorParameter(fieldparam);
if(params[fieldparam] != undefined && params[operatorId] != undefined) {
var values:string [] = decodeURIComponent(params[fieldparam]).split(",");
var operators:string [] = decodeURIComponent(params[operatorId]).split(",");
var values:string [] = StringUtils.URIDecode(params[fieldparam]).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var operators:string [] = (StringUtils.URIDecode(params[operatorId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
if(values.length == operators.length){
for(var j=0; j< values.length ; j++){
this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,values[j],operators[j]) )
this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,StringUtils.unquote(values[j]),operators[j]) )
}
}
}
@ -107,13 +113,14 @@ export class AdvancedSearchPageComponent {
fields[this.selectedFields[i].id].values =[];
fields[this.selectedFields[i].id].operators =[];
}
fields[this.selectedFields[i].id].values.push(this.selectedFields[i].value);
fields[this.selectedFields[i].id].values.push(StringUtils.quote(StringUtils.URIEncode(this.selectedFields[i].value)));
fields[this.selectedFields[i].id].operators.push(this.selectedFields[i].operatorId);
}
}
for(var i = 0; i< this.fieldIds.length; i++){
if(fields[this.fieldIds[i]]){
params+="&"+this.fieldIdsMap[this.fieldIds[i]].param+"="+fields[this.fieldIds[i]].values.join()+
"&"+this.getOperatorParameter(this.fieldIdsMap[this.fieldIds[i]].param)+"="+fields[this.fieldIds[i]].operators.join()
}
@ -131,9 +138,9 @@ export class AdvancedSearchPageComponent {
if(this.selectedFields[i].id == "q"){
var op = "";
// if()
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " ";
}else if(countParams == 0 && this.selectedFields[i].operatorId == "not"){
params += " "+ this.selectedFields[i].id + " <> "+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";
params += " "+ this.selectedFields[i].id + " <> "+'"' + StringUtils.URIEncode(this.selectedFields[i].value) +'"' + " ";
}else{
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " " ) + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator+'"' + encodeURIComponent(this.selectedFields[i].value) +'"' + " ";

View File

@ -5,7 +5,7 @@ import { Filter, Value} from './searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields} from '../../utils/properties/searchFields';
import {SearchUtilsClass} from './searchUtils.class';
import {DOI} from '../../utils/string-utils.class';
import {DOI, StringUtils} from '../../utils/string-utils.class';
import {ModalLoading} from '../../utils/modal/loading.component';
@Component({
@ -95,7 +95,7 @@ export class SearchPageComponent {
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++){
@ -105,15 +105,15 @@ export class SearchPageComponent {
if(this.queryParameters == undefined){
this.queryParameters = new Map<string,string>();
}
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
let values = decodeURIComponent(this.queryParameters[filterId]).split(",");
this.queryParameters[filterId]=StringUtils.URIDecode(params[filterId]);
let values = (StringUtils.URIDecode(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0;
var fq = "";
for(let value of values) {
countvalues++;
var paramId = this.fieldIdsMap[filterId].param;
parameters+='&' + paramId+ '='+ value;//+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or");
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " + this.quote(value) ;
// parameters+='&' + paramId+ '='+ value;//+"&" + this.fieldIdsMap[paramId].operator + "="+((countvalues == 1)?"and":"or");
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId +" exact " +value;// StringUtils.quote(value) ;
}
if(countvalues > 0){
fq="&fq="+fq;
@ -138,14 +138,14 @@ export class SearchPageComponent {
doiQuery += "&q=("+doisParams+")"
}
}else{
keywordQuery += "&q=("+this.quote(keyword) +")"
keywordQuery += "&q=("+StringUtils.quote(StringUtils.URIEncode(keyword)) +")";
}
}
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;
}
public getIndexQueryParametersFromUrl(params){
var parameters = "";
// var parameters = "";
var allFqs = "";
for(var i=0; i< this.refineFields.length ; i++){
@ -156,14 +156,14 @@ export class SearchPageComponent {
this.queryParameters = new Map<string,string>();
}
this.queryParameters[filterId]=decodeURIComponent(params[filterId]);
let values = decodeURIComponent(this.queryParameters[filterId]).split(",");
let values = (decodeURIComponent(this.queryParameters[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
var countvalues = 0
for(let value of values) {
countvalues++;
parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + this.quote(value);
// parameters+= ((countvalues == 1)?" and (":" or ")+ filterId+ '='+ value;
fq+=(fq.length > 0 ? " " + "or" + " ":"" ) + filterId + " exact " + value;//StringUtils.quote(value);
}
parameters+= " ) ";
// parameters+= " ) ";
if(countvalues > 0){
fq="&fq="+fq;
}
@ -186,7 +186,7 @@ export class SearchPageComponent {
doiQuery += "and ("+doisParams+")"
}
}else{
keywordQuery += "and ("+this.quote(keyword) +")"
keywordQuery += "and ("+StringUtils.quote(StringUtils.URIEncode(keyword)) +")";
}
}
@ -202,9 +202,11 @@ export class SearchPageComponent {
var filter:Filter = filters[i];
filter.countSelectedValues = 0;
if(this.queryParameters[filter.filterId] != undefined) {
let values = decodeURIComponent(this.queryParameters[filter.filterId]).split(",");
let values = (decodeURIComponent(this.queryParameters[filter.filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,-1);
console.log("Values"+values +" -- "+values.length);
for(let filterValue of filter.values) {
if(values.indexOf(filterValue.id) > -1) {
console.log("Filter id"+StringUtils.quote(filterValue.id));
if(values.indexOf(StringUtils.quote(filterValue.id)) > -1) {
filterValue.selected = true;
filter.countSelectedValues++;
}else{
@ -237,7 +239,7 @@ export class SearchPageComponent {
if(filter.countSelectedValues > 0){
for (let value of filter.values){
if(value.selected == true){
filterLimits+=((filterLimits.length == 0)?'':',') + encodeURIComponent(value.id);
filterLimits+=((filterLimits.length == 0)?'':',') +'"'+ StringUtils.URIEncode(value.id)+'"';
}
}
this.queryParameters[filter.filterId]=filterLimits;
@ -264,7 +266,7 @@ export class SearchPageComponent {
for (let value of filter.values){
if(value.selected == true){
count_selected++;
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
}
}
fq="&fq="+fq;
@ -284,10 +286,10 @@ export class SearchPageComponent {
if(doisParams.length > 0){
doiQuery += "&q=("+doisParams+")"
}else{
keywordQuery += "&q=("+this.quote(this.searchUtils.keyword) +")"
keywordQuery += "&q=("+StringUtils.quote(StringUtils.URIEncode(this.searchUtils.keyword)) +")"
}
}else{
keywordQuery += "&q=("+this.quote(this.searchUtils.keyword) +")"
keywordQuery += "&q=("+StringUtils.quote(StringUtils.URIEncode(this.searchUtils.keyword)) +")"
}
}
@ -303,7 +305,7 @@ export class SearchPageComponent {
for (let value of filter.values){
if(value.selected == true){
count_selected++;
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + this.quote(value.id);
fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + StringUtils.quote(StringUtils.URIEncode(value.id));
}
}
if(count_selected > 0){
@ -325,7 +327,7 @@ export class SearchPageComponent {
doiQuery += " and ("+doisParams+")"
}
}else{
keywordQuery += " and ("+this.quote(this.searchUtils.keyword) +")"
keywordQuery += " and ("+StringUtils.quote(StringUtils.URIEncode(this.searchUtils.keyword)) +")"
}
}
@ -466,9 +468,7 @@ export class SearchPageComponent {
}
return "&refine=true"+fieldsStr;
}
private quote(params: string):string {
return encodeURIComponent('"'+params+'"');
}
// for loading
public openLoading(){
if(this.loading){

View File

@ -41,7 +41,7 @@ export class ISVocabulariesService {
vocabulary = "dnet:access_modes.json";
return this.getVocabularyFromService(vocabulary);
} else if( (field == "datasourcetype") && (entity == "dataprovider")){
} else if( (field == "type") && (entity == "dataprovider")){
// file = "dataProviderType.json";
// return this.getVocabularyFromFile(file);
vocabulary = "dnet:datasource_typologies.json";
@ -59,7 +59,10 @@ export class ISVocabulariesService {
vocabulary = "dnet:countries.json";
return this.getVocabularyFromService(vocabulary);
}else{
console.error("No vocabulary found: "+field + " " + entity);
}
return null;
}
@ -100,7 +103,7 @@ export class ISVocabulariesService {
var array:AutoCompleteValue[] =[]
for(var i = 0; i < data.length; i++){
var value:AutoCompleteValue = new AutoCompleteValue();
value.id = data[i].code;
value.id = data[i].englishName;//data[i].code;
value.label = data[i].englishName;
array.push(value);
}

View File

@ -7,6 +7,7 @@ import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { CacheService } from '../shared/cache.service';
import {StringUtils} from '../utils/string-utils.class';
@Injectable()
export class EntitiesSearchService {
@ -33,7 +34,7 @@ export class EntitiesSearchService {
"(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 "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
"and (collectedfromdatasourcename exact "+DepositType+")) "
"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
}
@ -47,6 +48,9 @@ export class EntitiesSearchService {
request = request.json().results;
console.log(request);
return this.parse(request,"oaf:organization","organization");
}).catch((ex) => {
console.error('An error occured', ex);
return null;
});
}
searchByType(keyword:string,type:string){
@ -114,6 +118,9 @@ private fetch (link,id,oafEntityType,type){
{
request = request.json().results;
return this.parse(request,oafEntityType,type);
}).catch((ex) => {
console.error('An error occured', ex);
return null;
});

View File

@ -28,8 +28,9 @@ import {EntitiesSearchService} from '../services/entitySearch.service';
<li>
<span *ngIf="showLoading" class="uk-alert uk-alert-primary" data-uk-alert=""> <i class="uk-icon-spinner"></i> Loading... </span>
<span *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" data-uk-alert="">{{warningMessage}}</span>
<span *ngIf="showError" class="uk-alert uk-alert-danger" data-uk-alert="">An error Occured</span>
<span *ngIf="results > 0" > {{results}} results found:</span>
<span *ngIf="results == 0 && !showLoading" class="uk-alert uk-alert-info" data-uk-alert=""> No results found</span>
<span *ngIf="results == 0 && !showLoading && !showError" class="uk-alert uk-alert-info" data-uk-alert=""> No results found</span>
</li>
<li *ngFor=" let item of filtered | async">
<a (click)="select(item)" [title]="showItem(item)">{{truncate(showItem(item),19)}}</a>
@ -65,6 +66,7 @@ export class EntitiesAutocompleteComponent {
public sub;
public done = false;
public showLoading:boolean = false;
public showError:boolean = false;
public searchTermStream = new Subject<string>();
filtered: Observable<{}> ;
// public numFilteredResults:number = 0;
@ -88,7 +90,13 @@ export class EntitiesAutocompleteComponent {
.switchMap((term: string) => {
var results = this._search.searchProjectsByFunder(term, (this.funderId == "0"?"":this.funderId));
this.showLoading = false;
this.showError=false;
if(results == null){
this.showError = true;
this.results =0;
}else{
this.results = results.length;
}
return results;
});
}else if(this.entityType == "organization" && this.depositType ){

View File

@ -37,23 +37,23 @@ export class OpenaireProperties {
// private static searchAPIURL = " http://beta.services.openaire.eu/search/v2/api/";
// private searchAPIURL = "http://beta.services.openaire.eu:8480/search/rest/v2.0/api/";
private static searchAPIURL = " http://beta.services.openaire.eu/search/v2/api/";
private static searchAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
//"http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private static searchAPIURLLAst = " http://beta.services.openaire.eu/search/v2/api/";
private static searchAPIURLLAst = " http://beta.services.openaire.eu/search/v2/api/";
private static searchAPIURLLAst = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
//private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
//private static searchAPIURLLAst = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
// private static searchResourcesAPIURL = " http://beta.services.openaire.eu/search/v2/api/resources";
private static searchResourcesAPIURL = " http://beta.services.openaire.eu/search/v2/api/resources";
private static searchResourcesAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
//private static searchServiveURL = "http://astero.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/";
private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/";
private static searchServiveURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/";
// private static searchServiveURL = "http://services.openaire.eu:8380/search/";
// private static searchServiveURL = "http://beta.services.openaire.eu:8480/search/";
private static csvAPIURL = " http://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
private static csvAPIURL = "http://rudie.di.uoa.gr:6081/dnet-functionality-services-2.0.0-SNAPSHOT/rest/rest/v2/api/";//publications?format=csv
private static searchCrossrefAPIURL = "http://api.crossref.org/works";
private static searchDataciteAPIURL = "http://search.datacite.org/api";

View File

@ -7,10 +7,10 @@ export class SearchFields {
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicense"];//,"collectedfrom"];
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypenameid",
"resultlanguageid", "community","relprojectid", "relfunderid",
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypename",
"resultlanguagename", "community","relprojectid", "relfunderid",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultacceptanceyear","resultbestlicenseid","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
"resultacceptanceyear","resultbestlicense","pid","resulthostingdatasourceid","collectedfromdatasourceid","relpersonid"];
public RESULT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
@ -19,10 +19,10 @@ export class SearchFields {
["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
["resulthostingdatasourceid"]:{name:"Hosting Data Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
["relpersonid"]:{name:"Person", type:"entity", param:"person", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"refine", param:"lang", equalityOperator: " exact "},
["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
// ["instancetypenameid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
// ["resultlanguageid"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
["community"]:{name:"Community", type:"refine", param:"community", equalityOperator: " exact "},
["relproject"]:{name:"Project", type:"refine", param:"project", equalityOperator: " exact "},
["relprojectid"]:{name:"Project", type:"entity", param:"project", equalityOperator: " exact "},
@ -31,8 +31,8 @@ export class SearchFields {
["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
["resultacceptanceyear"]:{name:"Year", type:"year", param:"year", equalityOperator: " exact "},
["resultbestlicense"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
["resultbestlicenseid"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
["resultbestlicense"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
// ["resultbestlicenseid"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
["collectedfrom"]:{name:"Datasource", type:"refine", param:"datasource", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
};
@ -70,8 +70,8 @@ export class SearchFields {
public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname"];
public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
"datasourceenglishname","datasourceodsubjects", "datasourcetypeid","datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityid","relorganizationid", "collectedfromdatasourceid"];
"datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
@ -80,31 +80,30 @@ export class SearchFields {
["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", equalityOperator: "="},
["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", equalityOperator: " exact "},
["datasourcetypeid"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", equalityOperator: " exact "},
["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", equalityOperator: " exact "},
["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", equalityOperator: " exact "},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", equalityOperator: " exact "},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Data Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityid"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypeid","datasourcecompatibilityid"];
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiname","datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
//ORGANIZATION
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q",
"organizationlegalname","organizationlegalshortname","organizationcountryid"];
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","organizationcountryname"];
public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", equalityOperator: "="},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", equalityOperator: "="},
["organizationcountryid"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
["organizationcountryname"]:{name:"Country", type:"vocabulary", param:"country", equalityOperator: "="},
// ["organizationcountryname"]:{name:"Country", type:"refine", param:"country", equalityOperator: "="}
};
public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];

View File

@ -72,3 +72,21 @@ export class DOI{
}
}
export class StringUtils{
public static quote(params: string):string {
return '"'+params+'"';
}
public static unquote(params: string):string {
if(params.length > 2 && (params[0]=='"' && params[params.length-1]=='"') || (params[0]=="'" && params[params.length-1]=="'")){
params= params.substring(1, params.length-1);
}
return params;
}
public static URIEncode(params: string):string {
return encodeURIComponent(params);
}
public static URIDecode(params: string):string {
return decodeURIComponent(params);
}
}