165 lines
12 KiB
TypeScript
165 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 = ["instancetypename", "resultlanguagename", "community","relproject", "relfunderid",
|
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
|
"resultacceptanceyear","resultbestlicense"];//,"collectedfrom"];
|
|
|
|
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","relperson","resultpublisher","instancetypenameid",
|
|
"resultlanguageid", "community","relprojectid", "relfunderid",
|
|
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
|
|
"resultacceptanceyear","resultbestlicenseid","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: "="},
|
|
["relperson"]:{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 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 "},
|
|
["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 "},
|
|
["relfunderid"]:{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:"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 "},
|
|
["collectedfrom"]:{name:"Content Provider", type:"refine", param:"datasource", equalityOperator: " exact "},
|
|
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", equalityOperator: " exact "}
|
|
};
|
|
|
|
//PROJECT
|
|
|
|
public PROJECT_REFINE_FIELDS:string[] = ["funderid","fundinglevel0_id","fundinglevel1_id",
|
|
"fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
|
|
public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
|
|
"funderid", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
|
|
"projectstartyear","projectendyear","projectecsc39",
|
|
"projectcode","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: "="},
|
|
|
|
["funderid"]:{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 "},
|
|
|
|
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", equalityOperator: " exact "},
|
|
["projectcode"]:{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", "datasourcetypeid","datasourceodlanguages",
|
|
"datasourceodcontenttypes", "datasourcecompatibilityid","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 "},
|
|
["datasourcetypeid"]:{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 "},
|
|
["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","datasourcecompatibilityid"];
|
|
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypeid","datasourcecompatibilityid"];
|
|
|
|
//ORGANIZATION
|
|
|
|
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
|
|
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q",
|
|
"organizationlegalname","organizationlegalshortname","organizationcountryid"];
|
|
|
|
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: "="}
|
|
};
|
|
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 "},
|
|
|
|
};
|
|
|
|
//PERSON
|
|
public PERSON_REFINE_FIELDS:string[] = [];
|
|
public PERSON_ADVANCED_FIELDS:string[] = ["q","personsecondnames","personfirstname","personfullname"];
|
|
public PERSON_FIELDS: { [key:string]:FieldDetails}={
|
|
["q"]:{name:"All fields", type:"keyword", param:"q", equalityOperator: "="},
|
|
["personsecondnames"]:{name:"Surname", type:"keyword", param:"surname", equalityOperator: "="},
|
|
["personfirstname"]:{name:"First Name",type:"keyword", param:"name", equalityOperator: "="},
|
|
["personfullname"]:{name:"Full name", type:"keyword", param:"fullname", equalityOperator: "="}
|
|
};
|
|
|
|
|
|
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
|
|
"relfundinglevel0_id","relfundinglevel1_id,relfundinglevel2_id"];
|
|
|
|
public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funderid",
|
|
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunderid",
|
|
["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"){
|
|
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"){
|
|
return this.DATASOURCE_FIELDS[fieldId].name;
|
|
}else{
|
|
return "UNDEFINED";
|
|
}
|
|
}
|
|
}
|
|
class FieldDetails{
|
|
name:string;
|
|
type:string;
|
|
param:string;
|
|
equalityOperator:string;
|
|
}
|