160 lines
12 KiB
TypeScript
160 lines
12 KiB
TypeScript
export class SearchFields {
|
|
//main Entities
|
|
//RESULTS
|
|
//Used for datasets and publications
|
|
//In case Datasets should display different fields, use seperate tables for fields
|
|
public RESULT_REFINE_FIELDS = [
|
|
"relfunder",
|
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
|
"relproject","resultacceptanceyear",
|
|
"resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource"];
|
|
|
|
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","resultauthor","resultpublisher","instancetypename",
|
|
"resultlanguagename", "community","relprojectid", "relfunder",
|
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
|
"resultdateofacceptance","resultbestaccessright","pid","resulthostingdatasourceid","collectedfromdatasourceid", "relorganizationid"];
|
|
public RESULT_FIELDS: { [key:string]:FieldDetails}={
|
|
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
|
|
["resulttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
|
|
["resultauthor"]:{name:"Author", type:"keyword", param:"author", equalityOperator: "="},
|
|
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", equalityOperator: "="},
|
|
["pid"]:{name:"PID", type:"keyword", param:"pid", equalityOperator: " = "},
|
|
["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", equalityOperator: " exact "},
|
|
["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", 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 "},
|
|
["relfunder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
|
|
["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
|
|
["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:"Publication Date", type:"keyword", param:"year", equalityOperator: " exact "},
|
|
["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", equalityOperator: " within "},
|
|
["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", equalityOperator: " exact "},
|
|
// ["resultbestaccessright"]:{name:"Access Mode", type:"refine", param:"access", equalityOperator: " exact "},
|
|
["collectedfrom"]:{name:"Content Provider", type:"refine", param:"datasource", equalityOperator: " exact "},
|
|
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
|
|
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
|
|
};
|
|
|
|
//PROJECT
|
|
|
|
public PROJECT_REFINE_FIELDS:string[] = ["funder","fundinglevel0_id","fundinglevel1_id",
|
|
"fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
|
public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
|
|
"funder", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
|
|
"projectstartdate","projectenddate","projectecsc39",
|
|
"projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
|
|
public PROJECT_FIELDS: { [key:string]:FieldDetails}={
|
|
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
|
|
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", equalityOperator: "="},
|
|
["projecttitle"]:{name:"Title", type:"keyword", param:"title", equalityOperator: "="},
|
|
["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", equalityOperator: "="},
|
|
|
|
["funder"]:{name:"Funder", type:"refine", param:"funder", equalityOperator: " exact "},
|
|
["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", equalityOperator: " exact "},
|
|
["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", equalityOperator: " exact "},
|
|
["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", equalityOperator: " exact "},
|
|
["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", equalityOperator: " exact "},
|
|
["projectendyear"]:{name:"End Year", type:"year", param:"endyear", equalityOperator: " exact "},
|
|
["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", equalityOperator: " within "},
|
|
["projectenddate"]:{name:"End Date", type:"date", param:"enddate", equalityOperator: " within "},
|
|
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
|
|
["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", equalityOperator: " exact "},
|
|
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", equalityOperator: " exact "},
|
|
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
|
|
|
|
};
|
|
|
|
//DATAPROVIDERS
|
|
|
|
public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
|
|
"datasourcecompatibilityname"];
|
|
public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
|
|
"datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
|
|
"datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
|
|
|
|
public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
|
|
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
|
|
["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", equalityOperator: "="},
|
|
["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", equalityOperator: "="},
|
|
["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 "},
|
|
["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:"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 Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
|
|
};
|
|
|
|
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
|
|
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
|
|
public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
|
|
|
|
//ORGANIZATION
|
|
|
|
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
|
|
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: "="},
|
|
["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"];
|
|
public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
|
|
["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
|
|
public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , equalityOperator:string}} ={
|
|
["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, equalityOperator: "="},
|
|
["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", equalityOperator: "="},
|
|
["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", equalityOperator: "="},
|
|
["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", equalityOperator: " exact "},
|
|
["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", equalityOperator: " exact "},
|
|
|
|
};
|
|
|
|
|
|
|
|
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
|
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
|
|
|
|
public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
|
|
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
|
|
["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
|
|
|
|
|
|
public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
|
|
|
|
constructor (){
|
|
}
|
|
getFieldName(fieldId:string,fieldType:string):string{
|
|
if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software"){
|
|
return this.RESULT_FIELDS[fieldId].name;
|
|
}else if(fieldType == "project"){
|
|
return this.PROJECT_FIELDS[fieldId].name;
|
|
}else if(fieldType == "organization"){
|
|
return this.ORGANIZATION_FIELDS[fieldId].name;
|
|
}else if(fieldType == "datasource" || fieldType == "dataprovider"){
|
|
return this.DATASOURCE_FIELDS[fieldId].name;
|
|
}else{
|
|
return "UNDEFINED";
|
|
}
|
|
}
|
|
}
|
|
export class FieldDetails{
|
|
name:string;
|
|
type:string;
|
|
param:string;
|
|
equalityOperator:string;
|
|
}
|