Project

General

Profile

1
export class SearchFields {
2
  
3
  //main Entities
4
  //RESULTS
5
  //Used for datasets and publications and software and orp
6
  //In case Datasets or Software should display  different fields, use seperate tables for fields
7
  // "resultacceptanceyear",
8
  public RESULT_RANGE_FIELDS = [
9
    ["resultacceptanceyear", "resultacceptanceyear"]
10
  ];
11
  
12
  // Remove Collected From Filter "collectedfrom","collectedfrom"
13
  public RESULT_REFINE_FIELDS = [
14
    "resultbestaccessright", "relfunder",
15
    "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
16
    "relproject",
17
    "instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country"];
18

    
19
  public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher",
20
    "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance",
21
    "relfunder",
22
    "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
23
    "resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename"];
24
  public RESULT_FIELDS: { [key: string]: FieldDetails } = {
25
    ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
26
    ["resulttitle"]: {
27
      name: "Title",
28
      type: "keyword",
29
      param: "title",
30
      operator: "tt",
31
      equalityOperator: "=",
32
      filterType: null
33
    },
34
    ["resultauthor"]: {
35
      name: "Author",
36
      type: "keyword",
37
      param: "author",
38
      operator: "at",
39
      equalityOperator: "=",
40
      filterType: null
41
    },
42
    ["authorid"]: {
43
      name: "Author ORCID",
44
      type: "keyword",
45
      param: "orcid",
46
      operator: "oc",
47
      equalityOperator: " exact ",
48
      filterType: null
49
    },
50
    ["resultsubject"]: {
51
      name: "Subject",
52
      type: "keyword",
53
      param: "subject",
54
      operator: "sb",
55
      equalityOperator: "=",
56
      filterType: null
57
    },
58
    ["resultdescription"]: {
59
      name: "Description",
60
      type: "keyword",
61
      param: "description",
62
      operator: "ds",
63
      equalityOperator: "=",
64
      filterType: null
65
    },
66
    ["resultpublisher"]: {
67
      name: "Publisher",
68
      type: "keyword",
69
      param: "publisher",
70
      operator: "pb",
71
      equalityOperator: "=",
72
      filterType: null
73
    },
74
    ["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " = ", filterType: null},
75
    ["resulthostingdatasourceid"]: {
76
      name: "Hosting Content Provider",
77
      type: "entity",
78
      param: "hostedBy",
79
      operator: "hs",
80
      equalityOperator: " exact ",
81
      filterType: null
82
    },
83
    ["resulthostingdatasource"]: {
84
      name: "Content Provider",
85
      type: "refine",
86
      param: "hostedBy",
87
      operator: "hs",
88
      equalityOperator: " exact ",
89
      filterType: "checkbox"
90
    },
91
    ["instancetypename"]: {
92
      name: "Type",
93
      type: "vocabulary",
94
      param: "type",
95
      operator: "tp",
96
      equalityOperator: " exact ",
97
      filterType: "checkbox"
98
    },
99
    ["resultlanguagename"]: {
100
      name: "Language",
101
      type: "vocabulary",
102
      param: "lang",
103
      operator: "ln",
104
      equalityOperator: " exact ",
105
      filterType: "checkbox"
106
    },
107
    ["community"]: {
108
      name: "Community",
109
      type: "refine",
110
      param: "community",
111
      operator: "cm",
112
      equalityOperator: " exact ",
113
      filterType: "checkbox"
114
    },
115
    ["relproject"]: {
116
      name: "Project",
117
      type: "refine",
118
      param: "project",
119
      operator: "po",
120
      equalityOperator: " exact ",
121
      filterType: "checkbox"
122
    },
123
    ["relprojectid"]: {
124
      name: "Project",
125
      type: "entity",
126
      param: "project",
127
      operator: "po",
128
      equalityOperator: " exact ",
129
      filterType: null
130
    },
131
    ["relfunder"]: {
132
      name: "Funder",
133
      type: "refine",
134
      param: "funder",
135
      operator: "fn",
136
      equalityOperator: " exact ",
137
      filterType: "checkbox"
138
    },
139
    ["relfundinglevel0_id"]: {
140
      name: "Funding Stream",
141
      type: "refine",
142
      param: "funderlv0",
143
      operator: "fn0",
144
      equalityOperator: " exact ",
145
      filterType: "checkbox"
146
    },
147
    ["relfundinglevel1_id"]: {
148
      name: "Funding Substream level 1",
149
      type: "refine",
150
      param: "funderlv1",
151
      operator: "fn1",
152
      equalityOperator: " exact ",
153
      filterType: "checkbox"
154
    },
155
    ["relfundinglevel2_id"]: {
156
      name: "Funding Substream level 2",
157
      type: "refine",
158
      param: "funderlv2",
159
      operator: "fn0",
160
      equalityOperator: " exact ",
161
      filterType: "checkbox"
162
    },
163
    ["resultacceptanceyear"]: {
164
      name: "Publication Date",
165
      type: "keyword",
166
      param: "year",
167
      operator: "ya",
168
      equalityOperator: " = ",
169
      filterType: null
170
    },
171
    ["resultdateofacceptance"]: {
172
      name: "Publication Date",
173
      type: "date",
174
      param: "date",
175
      operator: "dt",
176
      equalityOperator: " within ",
177
      filterType: null
178
    },
179
    ["resultacceptanceyear-range-resultacceptanceyear"]: {
180
      name: "Year range",
181
      type: "keyword",
182
      param: "year",
183
      operator: "ya",
184
      equalityOperator: " within ",
185
      filterType: "range"
186
    },
187
    ["resultbestaccessright"]: {
188
      name: "Access Mode",
189
      type: "vocabulary",
190
      param: "access",
191
      operator: "ac",
192
      equalityOperator: " exact ",
193
      filterType: "radio"
194
    },
195
    ["collectedfrom"]: {
196
      name: "Collected From",
197
      type: "refine",
198
      param: "datasource",
199
      operator: "cl",
200
      equalityOperator: " exact ",
201
      filterType: "checkbox"
202
    },
203
    ["relorganizationid"]: {
204
      name: "Organization",
205
      type: "entity",
206
      param: "organization",
207
      operator: "og",
208
      equalityOperator: " exact ",
209
      filterType: null
210
    },
211
    ["collectedfromdatasourceid"]: {
212
      name: "Collected from Content Provider",
213
      type: "entity",
214
      param: "collectedFrom",
215
      operator: "cl",
216
      equalityOperator: " exact ",
217
      filterType: null
218
    },
219
    ["resulttypeid"]: {
220
      name: "Result type",
221
      type: "refine",
222
      param: "types",
223
      operator: "tp",
224
      equalityOperator: " exact ",
225
      filterType: "radio"
226
    },
227
    ["country"]: {
228
      name: "Country",
229
      type: "refine",
230
      param: "country",
231
      operator: "cu",
232
      equalityOperator: " exact ",
233
      filterType: "checkbox"
234
    }
235
  };
236
  
237
  //PROJECT
238
  public PROJECT_RANGE_FIELDS = [
239
    ["projectendyear", "projectstartyear"]
240
  ];
241
  public PROJECT_REFINE_FIELDS: string[] = ["funder", "fundinglevel0_id", "fundinglevel1_id",
242
    "fundinglevel2_id", "projectstartyear", "projectendyear", "projectecsc39"];
243
  public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle", "projectkeywords",
244
    "funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
245
    "projectstartdate", "projectenddate", "projectecsc39",
246
    "projectcode_nt", "relorganizationid", "collectedfromdatasourceid"];
247
  public PROJECT_FIELDS: { [key: string]: FieldDetails } = {
248
    ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
249
    ["projectacronym"]: {
250
      name: "Acronym",
251
      type: "keyword",
252
      param: "acronym",
253
      operator: "ar",
254
      equalityOperator: "=",
255
      filterType: null
256
    },
257
    ["projecttitle"]: {
258
      name: "Title",
259
      type: "keyword",
260
      param: "title",
261
      operator: "tt",
262
      equalityOperator: "=",
263
      filterType: null
264
    },
265
    ["projectkeywords"]: {
266
      name: "Keywords",
267
      type: "keyword",
268
      param: "keywords",
269
      operator: "ky",
270
      equalityOperator: "=",
271
      filterType: null
272
    },
273
    
274
    ["funder"]: {
275
      name: "Funder",
276
      type: "refine",
277
      param: "funder",
278
      operator: "fn",
279
      equalityOperator: " exact ",
280
      filterType: "checkbox"
281
    },
282
    ["fundinglevel0_id"]: {
283
      name: "Funding Stream",
284
      type: "refine",
285
      param: "funderlv0",
286
      operator: "fn0",
287
      equalityOperator: " exact ",
288
      filterType: "checkbox"
289
    },
290
    ["fundinglevel1_id"]: {
291
      name: "Funding Substream level 1",
292
      type: "refine",
293
      param: "funderlv1",
294
      operator: "fn1",
295
      equalityOperator: " exact ",
296
      filterType: "checkbox"
297
    },
298
    ["fundinglevel2_id"]: {
299
      name: "Funding Substream level 2",
300
      type: "refine",
301
      param: "funderlv2",
302
      operator: "fn2",
303
      equalityOperator: " exact ",
304
      filterType: "checkbox"
305
    },
306
    ["projectstartyear"]: {
307
      name: "Start Year",
308
      type: "year",
309
      param: "startyear",
310
      operator: "sy",
311
      equalityOperator: " <= ",
312
      filterType: "checkbox"
313
    },
314
    ["projectendyear"]: {
315
      name: "End Year",
316
      type: "year",
317
      param: "endyear",
318
      operator: "ey",
319
      equalityOperator: " >= ",
320
      filterType: "checkbox"
321
    },
322
    ["projectendyear-range-projectstartyear"]: {
323
      name: "Active within",
324
      type: "year",
325
      param: "year",
326
      operator: "ya",
327
      equalityOperator: " = ",
328
      filterType: "range"
329
    },
330
    ["projectstartdate"]: {
331
      name: "Start Date",
332
      type: "date",
333
      param: "startdate",
334
      operator: "sd",
335
      equalityOperator: " within ",
336
      filterType: null
337
    },
338
    ["projectenddate"]: {
339
      name: "End Date",
340
      type: "date",
341
      param: "enddate",
342
      operator: "ed",
343
      equalityOperator: " within ",
344
      filterType: null
345
    },
346
    ["projectecsc39"]: {
347
      name: "Special Clause 39",
348
      type: "boolean",
349
      param: "sc39",
350
      operator: "sc",
351
      equalityOperator: " exact ",
352
      filterType: "radio"
353
    },
354
    ["projectcode_nt"]: {
355
      name: "Project Code",
356
      type: "keyword",
357
      param: "code",
358
      operator: "cd",
359
      equalityOperator: " exact ",
360
      filterType: null
361
    },
362
    ["relorganizationid"]: {
363
      name: "Organization",
364
      type: "entity",
365
      param: "organization",
366
      operator: "og",
367
      equalityOperator: " exact ",
368
      filterType: null
369
    },
370
    ["collectedfromdatasourceid"]: {
371
      name: "Collected from Content Provider",
372
      type: "entity",
373
      param: "collectedFrom",
374
      operator: "cl",
375
      equalityOperator: " exact ",
376
      filterType: null
377
    }
378
    
379
  };
380
  
381
  //DATAPROVIDERS
382
// add Collected From Filter "collectedfromname"
383
  public DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
384
    "datasourcecompatibilityname", "country", "collectedfromname"];
385
  public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
386
    "datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
387
    "datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid"];
388
  
389
  public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
390
    ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
391
    ["datasourceofficialname"]: {
392
      name: "English name",
393
      type: "keyword",
394
      param: "officialname",
395
      operator: "of",
396
      equalityOperator: "=",
397
      filterType: null
398
    },
399
    ["datasourceenglishname"]: {
400
      name: "Title",
401
      type: "keyword",
402
      param: "engname",
403
      operator: "eg",
404
      equalityOperator: "=",
405
      filterType: null
406
    },
407
    ["datasourceodsubjects"]: {
408
      name: "Subject",
409
      type: "keyword",
410
      param: "subjects",
411
      operator: "sb",
412
      equalityOperator: "=",
413
      filterType: null
414
    },
415
    ["datasourcetypeuiid"]: {
416
      name: "Type",
417
      type: "refine",
418
      param: "type",
419
      operator: "tp",
420
      equalityOperator: " exact ",
421
      filterType: null
422
    },
423
    ["datasourcetypeuiname"]: {
424
      name: "Type",
425
      type: "refine",
426
      param: "type",
427
      operator: "tp",
428
      equalityOperator: " exact ",
429
      filterType: "checkbox"
430
    },
431
    ["datasourcetypename"]: {
432
      name: "Type",
433
      type: "vocabulary",
434
      param: "type",
435
      operator: "tp",
436
      equalityOperator: " exact ",
437
      filterType: null
438
    },
439
    ["datasourceodlanguages"]: {
440
      name: "Language",
441
      type: "vocabulary",
442
      param: "lang",
443
      operator: "ln",
444
      equalityOperator: " exact ",
445
      filterType: "checkbox"
446
    },
447
    ["datasourceodcontenttypes"]: {
448
      name: "Content",
449
      type: "refine",
450
      param: "content",
451
      operator: "cn",
452
      equalityOperator: " exact ",
453
      filterType: "checkbox"
454
    },
455
    ["datasourcecompatibilityid"]: {
456
      name: "Compatibility Level",
457
      type: "refine",
458
      param: "compatibility",
459
      operator: "cm",
460
      equalityOperator: " exact ",
461
      filterType: null
462
    },
463
    ["datasourcecompatibilityname"]: {
464
      name: "Compatibility Level",
465
      type: "vocabulary",
466
      param: "compatibility",
467
      operator: "cm",
468
      equalityOperator: " exact ",
469
      filterType: "checkbox"
470
    },
471
    ["relorganizationid"]: {
472
      name: "Organization",
473
      type: "entity",
474
      param: "organization",
475
      operator: "og",
476
      equalityOperator: " exact ",
477
      filterType: null
478
    },
479
    ["collectedfromname"]: {
480
      name: "Collected from",
481
      type: "entity",
482
      param: "collectedFrom",
483
      operator: "cl",
484
      equalityOperator: " exact ",
485
      filterType: "checkbox"
486
    },
487
    ["collectedfromdatasourceid"]: {
488
      name: "Collected from Content Provider",
489
      type: "entity",
490
      param: "collectedFrom",
491
      operator: "cl",
492
      equalityOperator: " exact ",
493
      filterType: null
494
    },
495
    ["country"]: {
496
      name: "Country",
497
      type: "vocabulary",
498
      param: "country",
499
      operator: "cu",
500
      equalityOperator: "=",
501
      filterType: "checkbox"
502
    }
503
  };
504
  
505
  public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string } [] = [
506
    {"name": "relorganizationname", "equalityOperator": "="},
507
    {"name": "relorganizationshortname", "equalityOperator": "="},
508
    {"name": "datasourceofficialname", "equalityOperator": "="},
509
    {"name": "datasourceenglishname", "equalityOperator": "="},
510
    {"name": "datasourcetypeuiname", "equalityOperator": " exact "},
511
    {"name": "country", "equalityOperator": " exact "},
512
    {"name": "datasourcesubject", "equalityOperator": " all "}
513
  ];
514
  public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
515
  
516
  public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
517
    ["datasourcetypeuiname"]: {
518
      name: "Repository type",
519
      type: "refine",
520
      param: "type",
521
      operator: "tp",
522
      equalityOperator: " exact ",
523
      filterType: "radio"
524
    },
525
    ["country"]: {
526
      name: "Countries",
527
      type: "vocabulary",
528
      param: "country",
529
      operator: "cu",
530
      equalityOperator: "=",
531
      filterType: "checkbox"
532
    },
533
    ["datasourceodsubjects"]: {
534
      name: "Subjects",
535
      type: "keyword",
536
      param: "subjects",
537
      operator: "sb",
538
      equalityOperator: "=",
539
      filterType: "checkbox"
540
    },
541
    ["datasourceodcontenttypes"]: {
542
      name: "Content type",
543
      type: "refine",
544
      param: "content",
545
      operator: "cn",
546
      equalityOperator: " exact ",
547
      filterType: "checkbox"
548
    },
549
    ["datasourcecompatibilityname"]: {
550
      name: "Compatibility Level",
551
      type: "vocabulary",
552
      param: "compatibility",
553
      operator: "cm",
554
      equalityOperator: " exact ",
555
      filterType: "checkbox"
556
    },
557
  };
558
  
559
  public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
560
  public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
561
  public JOURNAL_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
562
  
563
  //ORGANIZATION
564
  
565
  public ORGANIZATION_REFINE_FIELDS: string[] = ["country"]
566
  public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country"];
567
  
568
  public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = {
569
    ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
570
    ["organizationlegalname"]: {
571
      name: "Legal Name",
572
      type: "keyword",
573
      param: "name",
574
      operator: "nm",
575
      equalityOperator: "=",
576
      filterType: null
577
    },
578
    ["organizationlegalshortname"]: {
579
      name: "Legal Short Name",
580
      type: "keyword",
581
      param: "shortname",
582
      operator: "so",
583
      equalityOperator: "=",
584
      filterType: null
585
    },
586
    ["country"]: {
587
      name: "Country",
588
      type: "vocabulary",
589
      param: "country",
590
      operator: "cu",
591
      equalityOperator: "=",
592
      filterType: "checkbox"
593
    },
594
  };
595
  //  public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
596
  // public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
597
  //  public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
598
  //   ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
599
  // public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , operator: "op", equalityOperator:string}} ={
600
  // ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, operator: "op", equalityOperator: "="},
601
  // ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", operator: "op", equalityOperator: "="},
602
  // ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", operator: "op", equalityOperator: "="},
603
  // ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", operator: "op", equalityOperator: " exact "},
604
  // ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", operator: "op", equalityOperator: " exact "},
605
  //
606
  // };
607

    
608

    
609
//add project field  depending on funder
610
  public HIDDEN_FIELDS: string[] = ["fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
611
    "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject"];
612
  
613
  public DEPENDENT_FIELDS: { [key: string]: string } = {
614
    ["relproject"]: "relfunder",
615
    ["fundinglevel0_id"]: "funder",
616
    ["fundinglevel1_id"]: "fundinglevel0_id",
617
    ["fundinglevel2_id"]: "fundinglevel1_id",
618
    ["relfundinglevel0_id"]: "relfunder",
619
    ["relfundinglevel1_id"]: "relfundinglevel0_id",
620
    ["relfundinglevel2_id"]: "relfundinglevel1_id"
621
  };
622
  
623
  
624
  public ADVANCED_SEARCH_OPERATORS: { name: string, id: string }[] = [{name: "AND", id: "and"}, {
625
    name: "OR",
626
    id: "or"
627
  }, {name: "NOT", id: "not"}];
628
  
629
  public COMMUNITIES_SEARCH_FIELDS: string[] = ["type", "status", "role"];
630
  
631
  public STAKEHOLDER_SEARCH_FIELDS: string[] = ["type", "access", "role"];
632
  
633
  constructor() {
634
  }
635
  
636
  getFieldName(fieldId: string, fieldType: string): string {
637
    if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
638
      return this.RESULT_FIELDS[fieldId].name;
639
    } else if (fieldType == "project") {
640
      return this.PROJECT_FIELDS[fieldId].name;
641
    } else if (fieldType == "organization") {
642
      return this.ORGANIZATION_FIELDS[fieldId].name;
643
    } else if (fieldType == "datasource" || fieldType == "dataprovider") {
644
      return this.DATASOURCE_FIELDS[fieldId].name;
645
    } else {
646
      return "UNDEFINED";
647
    }
648
  }
649
  
650
  getFieldFilterType(fieldId: string, fieldType: string, usedBy: string = "search"): string {
651
    if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
652
      return this.RESULT_FIELDS[fieldId].filterType;
653
    } else if (fieldType == "project") {
654
      return this.PROJECT_FIELDS[fieldId].filterType;
655
    } else if (fieldType == "organization") {
656
      return this.ORGANIZATION_FIELDS[fieldId].filterType;
657
    } else if (fieldType == "datasource" || fieldType == "dataprovider") {
658
      if (usedBy == "search") {
659
        return this.DATASOURCE_FIELDS[fieldId].filterType;
660
      } else if (usedBy == "deposit") {
661
        return this.DEPOSIT_DATASOURCE_FIELDS[fieldId].filterType;
662
      }
663
    } else {
664
      return "checkbox";
665
    }
666
  }
667
  
668
  getFieldParam(fieldId: string, fieldType: string): string {
669
    if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
670
      return this.RESULT_FIELDS[fieldId].param;
671
    } else if (fieldType == "project") {
672
      return this.PROJECT_FIELDS[fieldId].param;
673
    } else if (fieldType == "organization") {
674
      return this.ORGANIZATION_FIELDS[fieldId].param;
675
    } else if (fieldType == "datasource" || fieldType == "dataprovider") {
676
      return this.DATASOURCE_FIELDS[fieldId].param;
677
    } else {
678
      return "UNDEFINED";
679
    }
680
  }
681
  public static getParameterOrder(fieldId: string,  params): number {
682
    let fields = [];
683
    let searchFields =  new SearchFields();
684
    if (searchFields.RESULT_REFINE_FIELDS.indexOf(fieldId) !=-1) {
685
      fields =  searchFields.RESULT_REFINE_FIELDS;
686
    } else if (searchFields.PROJECT_REFINE_FIELDS.indexOf(fieldId) !=-1) {
687
      fields =  searchFields.PROJECT_REFINE_FIELDS
688
    } else if (searchFields.ORGANIZATION_REFINE_FIELDS.indexOf(fieldId) !=-1) {
689
      fields =  searchFields.ORGANIZATION_REFINE_FIELDS;
690
    } else if (searchFields.DATASOURCE_REFINE_FIELDS.indexOf(fieldId) !=-1) {
691
      fields =  searchFields.DATASOURCE_REFINE_FIELDS;
692
    }
693
    let index = fields.indexOf(fieldId);
694
    let paramIndex  = 0;
695
    if(index != -1){
696
      for(let keyValue of params){
697
        if(fields.indexOf(keyValue[0])>index){
698
          break;
699
        }
700
        paramIndex++
701
      }
702
    }
703
    return paramIndex;
704
  }
705
  /*
706
  AND
707
    Funder: relfunder, relfundinglevel0_id, relfundinglevel1_id, relfundinglevel2_id
708
    Project: relproject
709
    Community: community
710
  OR
711
    Type: instancetypename, datasourcetypeuiname
712
    Language: resultlanguagename, datasourceodlanguages
713
    Compatibility Level: datasourcecompatibilityname
714
    Country: country
715
    Content: datasourceodcontenttypes
716
    Content Provider: resulthostingdatasource
717
    Collected From: collectedfrom
718
  BULLETS
719
    Access Mode: resultbestaccessright
720
    Special Clause 39: projectecsc39
721
    Versioning:
722
  
723
  RANGE
724
    Publication date: resultacceptanceyear
725
    Project life: projectstartyear, projectendyear
726
  
727
  ? WHAT ABOUT ?:
728
    Subjects:
729
    Supported Identifiers:
730
  */
731
  
732
  getFieldOperator(fieldId: string): string {
733
    if (fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id"
734
      || fieldId == "relproject" || fieldId == "community" || fieldId == "projectendyear-range-projectstartyear") {
735
      return "and";
736
    } else if (fieldId == "instancetypename" || fieldId == "datasourcetypeuiname"
737
      || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages"
738
      || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes"
739
      || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") {
740
      return "or";
741
    }
742
    return "or";
743
  }
744
}
745

    
746
export class FieldDetails {
747
  name: string;
748
  type: string;
749
  param: string;
750
  equalityOperator: string;
751
  operator: string;
752
  filterType: string = "checkbox";
753
}
(4-4/4)