[Trunk | Library]:

1. compatibleDataProviders.component & compatibleDataProvidersTable.component & entityRegistries.component & entityRegistriesTable.component & journals.component & journalsTable.component:
	Add 'valueIsUnique' field in 'Filter'.
2. searchFilter.component: Add case when filter has unique value (radio button) | Show more values either in modal or inline (new mocks for connect)
3. searchHelperClasses.class: Add 'valueIsUnique' field.
4. searchPage.component: 
	Add title in Filters & show download-map-table options above selected filters
	Keyword query in specific fields (defined in properties/searchFields) when used by new deposit pages
5. searchDataproviders.service: Add method 'searchDataprovidersForDepositSearch()'
6. refineResults.class: Fill "valueIsUnique" field of filter.
7. properties/searchFields: Add 'uniqueValue: boolean' (default false) field in 'FieldDetails' class and 'fieldHasUniqueValue()' function which checks 'fieldType' and 'usedBy'.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56562 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-07-15 16:11:07 +00:00
parent d75b540775
commit a4d51b6d7f
15 changed files with 352 additions and 135 deletions

View File

@ -203,7 +203,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -250,7 +250,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i] };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i], valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -193,7 +193,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -255,7 +255,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i] };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: filter_valueIsExact[i], valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -196,7 +196,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -210,7 +210,7 @@ properties:EnvProperties;
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:j, selected:false}
values.push(value);
}
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true };
var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId: filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, valueIsUnique: false };
filters.push(filter);
}
return filters;

View File

@ -4,27 +4,107 @@
<h5 class="uk-margin-bottom-remove searchFilterTitle">{{_formatTitle(filter.title,filter.values.length)}}
</h5>
<div aria-expanded="false">
<div class="searchFilterBoxValues ">
<div [class]="showMoreInline ? '' : 'searchFilterBoxValues' ">
<div *ngFor = "let value of getSelectedValues(filter,'num')" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}">
<input [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
<label>
<span class="filterName">
<div title = "{{value.name}}">
<input *ngIf="!filter.valueIsUnique" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<!-- [name]=filter.filterId value="false"-->
<input *ngIf="filter.valueIsUnique" type="radio" (click)="uniqueFilterChange(value)"
[name]=filter.filterId checked/>
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>
</span>
</label>
</div>
<!-- <hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small"-->
<div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:5-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem">
<!-- <hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small"-->
<span class="filterName"><div title = "{{value.name}}" [class]="(isDisabled || (showResultCount && value.number === 0))?'uk-text-muted':''" > <input [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" [class]="(isDisabled || value.number === 0)?'uk-text-muted':''" > ({{value.number|number}})</span>
<div *ngFor = "let value of getNotSelectedValues(filter,'num').slice(0,(!addShowMore?getNotSelectedValues(filter,'num').length:filterValuesNum-getSelectedValues(filter,'num').length))" class = "uk-animation-fade filterItem">
<label>
<span class="filterName">
<div title = "{{value.name}}" [class]="(isDisabled || (showResultCount && value.number === 0))?'uk-text-muted':''" >
<input *ngIf="!filter.valueIsUnique" [disabled]="isDisabled || (showResultCount && value.number === 0)" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="filterChange(value.selected)" />
<input *ngIf="filter.valueIsUnique" [disabled]="isDisabled || (showResultCount && value.number === 0)" type="radio" (click)="uniqueFilterChange(value)"
[name]=filter.filterId value=false />
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" [class]="(isDisabled || value.number === 0)?'uk-text-muted':''" >
({{value.number|number}})
</span>
</div>
</span>
</label>
</div>
<a *ngIf=" addShowMore && (filter.values.length) > 5" (click)="open()"
<div *ngIf=" addShowMore && showMoreInline && (filter.values.length) > filterValuesNum">
<a [class]="(isDisabled)?'uk-disabled uk-link-muted uk-text-secondary':' uk-text-secondary'"
[attr.uk-toggle]="'target: #toggle-'+filter.filterId">View
<span *ngIf="filter.values.length >= 99">more</span>
<span *ngIf="filter.values.length < 99">all</span>
</a>
<div hidden [id]="'toggle-'+filter.filterId">
<!-- <div *ngIf="filter.values.length >= 99" class="uk-alert uk-alert-primary uk-text-center uk-margin-right uk-margin-left uk-margin-small-top uk-margin-small-bottom ">Showing top {{filter.values.length}} values. </div>-->
<div class="">
<input class="uk-input uk-margin-small-bottom uk-width-1-1 " name="filter-keyword" placeholder="Search for {{filter.title}}" type="text" [(ngModel)]="keyword">
<select *ngIf = "showResultCount === true" [(ngModel)]="sortBy"
class="uk-text-muted uk-select uk-margin-small-bottom uk-width-1-1" name="select_order" (ngModelChange)="sortByChanged = true;" >
<option value="num">Sorted by results number</option>
<option value="name">Sorted by name</option>
</select>
</div>
<div class="uk-modal-body uk-overflow-auto uk-height-small uk-padding-remove
uk-margin-small-left uk-margin-small-right uk-margin-small-top uk-margin-bottom">
<ng-container *ngFor = "let value of getSelectedValues(filter, sortBy)">
<div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem">
<label>
<span class="filterName">
<div title = "{{value.name}}">
<input *ngIf="!filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
<input *ngIf="filter.valueIsUnique" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"
[name]=filter.filterId checked/>
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>
</span>
</label>
</div>
</ng-container>
<hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small">
<ng-container *ngFor = "let value of getNotSelectedValues(filter, sortBy)">
<div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem">
<label>
<span class="filterName">
<div title = "{{value.name}}">
<input *ngIf="!filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
<input *ngIf="filter.valueIsUnique" [disabled]="isDisabled" type="radio" (click)="uniqueFilterChange(value)"
[name]=filter.filterId value=false />
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>
</span>
</label>
</div>
</ng-container>
</div>
</div>
</div>
<a *ngIf=" addShowMore && !showMoreInline&& (filter.values.length) > filterValuesNum" (click)="open()"
[class]="(isDisabled)?'uk-disabled uk-link-muted uk-text-secondary':' uk-text-secondary'">View more
</a>
<div *ngIf="addShowMore" [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" uk-modal [open]="!isOpen" id="modal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" bg-close="true">
<div *ngIf="addShowMore && !showMoreInline" [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" uk-modal [open]="!isOpen" id="modal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" bg-close="true">
<div class="filtersModal uk-modal-dialog uk-small-1-2 uk-width-medium-1-3 uk-width-1-3 uk-padding-small uk-padding-remove-top uk-padding-remove-horizontal">
<button type="button" class="uk-modal-close-default" uk-close (click)="close()"></button>
@ -44,19 +124,34 @@
uk-margin-medium-left uk-margin-medium-right uk-margin-small-top uk-margin-bottom">
<ng-container *ngFor = "let value of getSelectedValues(filter, sortBy)">
<div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}">
<input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
<label>
<span class="filterName"><div title = "{{value.name}}">
<input *ngIf="!filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
<input *ngIf="filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="radio" [name]=filter.filterId (ngModelChange)="close(); filterChange(value.selected)" />
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" > {{' '}}({{value.number|number}})</span>
</div>
</span>
</label>
</div>
</ng-container>
<hr *ngIf="filter.countSelectedValues > 0 && (filter.values.length-filter.countSelectedValues ) > 0 " class="uk-grid-divider uk-margin-small">
<ng-container *ngFor = "let value of getNotSelectedValues(filter, sortBy)">
<div *ngIf="filterKeywords(value.name)" class = "uk-animation-fade filterItem">
<span class="filterName"><div title = "{{value.name}}">
<input [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
{{_formatName(value)}} </div></span>
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
<label>
<span class="filterName">
<div title = "{{value.name}}">
<input *ngIf="!filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="checkbox" (ngModelChange)="close(); filterChange(value.selected)" />
<input *ngIf="filter.valueIsUnique" [disabled]="isDisabled" [(ngModel)]="value.selected" type="radio" [name]=filter.filterId (ngModelChange)="close(); filterChange(value.selected)" />
{{' '}}
{{_formatName(value)}}
{{' '}}
<span class="filterNumber" *ngIf = "showResultCount === true" > ({{value.number|number}})</span>
</div>
</span>
</label>
</div>
</ng-container>
</div>

View File

@ -15,6 +15,8 @@ export class SearchFilterComponent {
@Input() showResultCount:boolean = true;
@Input() isDisabled:boolean = false;
@Input() addShowMore:boolean = true;
@Input() showMoreInline: boolean = false;
@Input() filterValuesNum: number = 5;
public showAll:boolean = false;
public _maxCharacters:number =28;
@ -77,6 +79,20 @@ export class SearchFilterComponent {
value: this.filter
});
}
uniqueFilterChange(value: Value) {
let tmp = value.selected;
value.selected = !tmp;
if(value.selected){
this.filter.countSelectedValues++;
}else{
this.filter.countSelectedValues--;
}
this.onFilterChange.emit({
value: this.filter
});
}
getSelectedValues(filter, sortBy:string = "num"):any{
var selected = [];
if(filter.countSelectedValues >0){

View File

@ -7,7 +7,8 @@ export class Filter{
public values: Value[] = [];
public filterOperator: string ='or';
public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry
public valueIsUnique: boolean = false;
// public uniqueValueIdSelected: string;
}
export class Value{

View File

@ -1,6 +1,6 @@
<div class="image-front-topbar uk-section-default" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
<div style=" min-height: 400px;" [class]="' uk-background-norepeat uk-background-bottom-center uk-section uk-padding-remove-bottom uk-flex uk-flex-middle uk-background-fixed '+searchFormClass">
<div class="uk-container uk-position-relative uk-section uk-margin-large-top">
<div class="image-front-topbar uk-section-default" uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}" tm-header-transparent="light">
<div [class]="usedBy == 'deposit' ? 'uk-margin-large-bottom ' : 'searchFormMinHeight uk-padding-remove-bottom' + ' uk-background-norepeat uk-background-bottom-center uk-section uk-flex uk-flex-middle uk-background-fixed '+searchFormClass">
<div [class]="'uk-container uk-position-relative uk-margin-large-top' + (usedBy == 'deposit' ? ' uk-container-large' : '')">
<div class="uk-width-1-1">
<!--link to advanced search -->
<a *ngIf = "advancedSearchLink && advancedSearchLink.length > 0" routerLinkActive="router-link-active" [class]="((disableForms)?'uk-float-right uk-disabled uk-link-muted uk-light ':'uk-float-right uk-light') +' portal-color uk-margin-small-bottom'" [routerLink]=advancedSearchLink [queryParams]=advancedSearchParameters >
@ -22,7 +22,7 @@
<div uk-grid >
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="">
<div class="uk-container">
<div [class]="'uk-container' + (usedBy == 'deposit' ? ' uk-container-large' : '')">
<helper position="top"></helper>
<div [class]="(showRefine)? 'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s' :'uk-width-1-1'">
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m">
@ -34,7 +34,26 @@
<button class="uk-offcanvas-close" type="button" uk-close></button>
<div class="uk-width-1-1 uk-margin-small-bottom uk-margin-top">
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community' && usedBy == 'search'"
class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download>
<div *ngIf="countFilters()>0" class="uk-margin-small-bottom">
<div class="uk-grid uk-margin-bottom uk-margin-top">
<span class="uk-text-bold uk-text-large">Filters</span>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
</div>
<span *ngIf = "searchUtils.keyword.length > 0"><span class="uk-text-bold">Keywords:</span>
<a (click) = "clearKeywords() " title="Remove keywords" [class]="((disableForms)?' uk-disabled':' ')+' uk-margin-small-right portal-color '"><span class=" clickable " aria-hidden="true"><span class="uk-icon ">
@ -59,20 +78,7 @@
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community'" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
</div>
<div class="uk-text-large">Filter By:</div>
@ -91,7 +97,26 @@
<!-- top: #container-1; bottom: #true; -->
<!-- <div id="container-1" style="z-index: -1;" uk-sticky="top: #container-1; offset: 120; "> -->
<helper position="left" before="true"></helper>
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community' && usedBy == 'search'"
class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
</search-download>
<div class="uk-width-1-1 uk-margin-small-bottom ">
<div class="uk-grid uk-margin-bottom uk-margin-top">
<span class="uk-text-bold uk-text-large">Filters</span>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
</div>
<div *ngIf="countFilters()>0" class="uk-margin-small-bottom">
@ -104,36 +129,23 @@
</span>
<div *ngFor="let filter of filters " >
<span *ngIf = "filter.countSelectedValues > 0"> <span class="uk-text-bold">{{filter.title}}:</span>
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " >
<a [title]="'Remove '+value.name"(click) = "removeFilter(value, filter) " [class]="((disableForms)?' uk-disabled':' ')+' portal-color '"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<label *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "
[title]="'Remove '+value.name" (click) = "removeFilter(value, filter) ">
<a [class]="((disableForms)?' uk-disabled':' ')+' portal-color '"><span class=" clickable" aria-hidden="true"><span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span></span></a>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name" [title]="value.name"></span><span *ngIf="!end" class=" ">, </span>
</span>
</span></span>
</a>
<span [innerHtml]="(value.name.length > 25)?value.name.substring(0,25)+'...':value.name"></span><span *ngIf="!end" class=" ">, </span>
</label>
</span>
</div>
</div>
<div class="uk-margin-small-bottom uk-margin-small-top uk-grid">
<a *ngIf= "showUnknownFilters" class = " portal-link" (click) = "clearFilters() " >Try new Query</a>
<a *ngIf="countFilters()>1" (click)="clearFilters()" [class]="((disableForms)?'uk-disabled uk-link-muted':'')+' portal-link ' + 'uk-width-1-2'">
Clear All
</a>
<span *ngIf="tableViewLink || mapUrl" class="uk-width-expand">
<span *ngIf="tableViewLink">
<a uk-tooltip="title: Table view" routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
</a>
<span uk-tooltip="title: List view" class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
</span>
<search-dataprovider-map *ngIf= "!showUnknownFilters" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [mapUrl]="mapUrl" [mapTooltipType]="mapTooltipType"></search-dataprovider-map>
</span>
<search-download *ngIf= "!showUnknownFilters && searchUtils.totalResults > 0 && entityType != 'community'" class="uk-width-1-2" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
</div>
</div>
</div>
<search-filter *ngFor="let filter of filters " [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" ></search-filter>
<search-filter *ngFor="let filter of filters " [filterValuesNum]="filterValuesNum" [showMoreInline]="showMoreFilterValuesInline" [isDisabled]="disableForms" [filter]="filter" [showResultCount]=showResultCount (onFilterChange)="filterChanged($event)" ></search-filter>
<helper position="left" before="false"></helper>
</div>
<!-- </div> -->
@ -154,13 +166,19 @@
<search-paging *ngIf="searchUtils.totalResults == 1" [type]="entityType" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues"></search-paging>
</div>
<div *ngIf="(searchUtils.page <= pagingLimit)" class="">
<search-result *ngIf="entityType != 'community' && !tableView"
<search-result *ngIf="entityType != 'community' && !tableView && usedBy == 'search'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showLoading]="true" [(properties)]=properties>
</search-result>
<community-search-result *ngIf="entityType == 'community' && !tableView"
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"
[showLoading]="true" [(properties)]=properties>
</deposit-result>
<community-search-result *ngIf="entityType == 'community' && !tableView && usedBy == 'search'"
[results]="results"
[status]="searchUtils.status"
[type]="entityType"

View File

@ -30,6 +30,9 @@ export class SearchPageComponent {
@Input() filters = [];
@Input() type:string = "";
@Input() entityType: string = "";
@Input() usedBy: string = "search";
@Input() showMoreFilterValuesInline: boolean = false;
@Input() filterValuesNum: number = 5;
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
@Output() queryChange = new EventEmitter();
@Input() baseUrl:string = '';
@ -57,6 +60,7 @@ export class SearchPageComponent {
//@Input() sortBy: string = "";
@ViewChild (ModalLoading) loading : ModalLoading ;
public fieldIdsMap;//: { [key:string]:{ name:string, operator:string, type:string, indexField:string, equalityOperator:string }};
@Input() keywordFields = [];
private searchFieldsHelper:SearchFields = new SearchFields();
private queryParameters: Map<string, string> = new Map<string,string>();
private baseURLWithParameters:string = '';
@ -192,7 +196,21 @@ export class SearchPageComponent {
keywordQuery += "&q="+StringUtils.URIEncode(keyword);
}
}else{
keywordQuery += "&q="+StringUtils.URIEncode(keyword);
if(this.usedBy == "deposit") {
if(this.keywordFields.length > 0) {
keywordQuery = "&fq=";
}
for(let i=0; i< this.keywordFields.length ; i++) {
if(i > 0) {
keywordQuery += " or ";
}
let field = this.keywordFields[i];
keywordQuery += field.name+field.equalityOperator+StringUtils.URIEncode(keyword);
}
} else {
keywordQuery += "&q=" + StringUtils.URIEncode(keyword);
}
}
}
@ -410,7 +428,21 @@ export class SearchPageComponent {
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
}
}else{
keywordQuery += "&q="+StringUtils.URIEncode(this.searchUtils.keyword);
if(this.usedBy == "deposit") {
if(this.keywordFields.length > 0) {
keywordQuery = "&fq=";
}
for(let i=0; i< this.keywordFields.length ; i++) {
if(i > 0) {
keywordQuery += " or ";
}
let field = this.keywordFields[i];
keywordQuery += field.name+field.equalityOperator+StringUtils.URIEncode(this.searchUtils.keyword);
}
} else {
keywordQuery += "&q=" + StringUtils.URIEncode(this.searchUtils.keyword);
}
}
}
return (doiQuery.length > 0 ? doiQuery:keywordQuery) + allFqs;

View File

@ -21,12 +21,14 @@ import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import { SearchDataproviderMapModule } from './searchDataproviderMap.module';
import {CommunitySearchResultsModule} from "./communitySearchResults.module";
import {SearchResultsModule} from "./searchResults.module";
import {SearchResultsInDepositModule} from "../../deposit/searchResultsInDeposit.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, SearchFormModule, SearchResultsModule, CommunitySearchResultsModule,
LoadingModalModule, ReportsServiceModule, SearchDataproviderMapModule,
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule, SearchResultsModule
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule, SearchFilterModule, PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule, SearchResultsModule,
SearchResultsInDepositModule
],
declarations: [
SearchPageComponent

View File

@ -15,8 +15,7 @@ import {map} from "rxjs/operators";
export class SearchDataprovidersService {
constructor(private http: HttpClient ) {}
searchDataproviders (params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
searchDataproviders (params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties, usedBy: string="search" ):any {
let link = properties.searchAPIURLLAst+"datasources";
let url = link+"?";
@ -32,7 +31,7 @@ export class SearchDataprovidersService {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
//.do(res => console.info(res))
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
}
//((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties ):any {
@ -161,6 +160,20 @@ export class SearchDataprovidersService {
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
searchDataprovidersForDepositSearch(params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties, usedBy: string="search" ):any {
let link = properties.searchResourcesAPIURL;
let url = link+"?query=((deletedbyinference = false) AND (oaftype exact datasource)) "+params;
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],
refineFields, "datasource", usedBy)]));
}
searchDataProvidersBySubjects(keyword:string, type:string, page: number, size: number, properties:EnvProperties):any {
let link = properties.searchResourcesAPIURL;
var compatibilities = "";

View File

@ -6,7 +6,7 @@ import { SearchFields, FieldDetails} from '../../utils/properties/searchFields';
export class RefineResultsUtils {
public static parse (data, fields:string[], entityType:string):Filter[] {
public static parse (data, fields:string[], entityType:string, usedBy: string="search"):Filter[] {
// var data = this.json.refineReuslts;
var searchFields:SearchFields = new SearchFields();
@ -18,6 +18,9 @@ export class RefineResultsUtils {
filter.title = searchFields.getFieldName(fields[j],entityType);
filter.filterId = fields[j];
filter.originalFilterId = fields[j];
filter.valueIsUnique = searchFields.fieldHasUniqueValue(fields[j], entityType, usedBy);
//console.info("filter.title: "+filter.title+" filter.valueIsUnique: "+filter.valueIsUnique);
let field = data[fields[j]];
if(field){
for(let i=0; i<field.length; i++) {

View File

@ -16,31 +16,31 @@ export class SearchFields {
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultlanguagename", "relorganizationid", "pid","relprojectid", "instancetypename"];
public RESULT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "="},
["resultauthor"]:{name:"Author", type:"keyword", param:"author", operator: "at", equalityOperator: "="},
["authorid"]:{name:"Author ORCID", type:"keyword", param:"orcid", operator: "oc", equalityOperator: " exact "},
["resultsubject"]:{name:"Subject", type:"keyword", param:"subject", operator: "sb", equalityOperator: "="},
["resultdescription"]:{name:"Description", type:"keyword", param:"description", operator: "ds", equalityOperator: "="},
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", operator: "pb", equalityOperator: "="},
["pid"]:{name:"PID", type:"keyword", param:"pid", operator: "pd", equalityOperator: " = "},
["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", operator: "hs", equalityOperator: " exact "},
["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", operator: "hs", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact "},
["community"]:{name:"Community", type:"refine", param:"community", operator: "cm", equalityOperator: " exact "},
["relproject"]:{name:"Project", type:"refine", param:"project", operator: "po", equalityOperator: " exact "},
["relprojectid"]:{name:"Project", type:"entity", param:"project", operator: "po", equalityOperator: " exact "},
["relfunder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact "},
["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact "},
["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact "},
["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn0", equalityOperator: " exact "},
["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", operator: "ya", equalityOperator: " exact "},
["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", operator: "dt", equalityOperator: " within "},
["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", operator: "ac", equalityOperator: " exact "},
["collectedfrom"]:{name:"Collected From", type:"refine", param:"datasource", operator: "cl", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "}
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", uniqueValue: false},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "=", uniqueValue: false},
["resultauthor"]:{name:"Author", type:"keyword", param:"author", operator: "at", equalityOperator: "=", uniqueValue: false},
["authorid"]:{name:"Author ORCID", type:"keyword", param:"orcid", operator: "oc", equalityOperator: " exact ", uniqueValue: false},
["resultsubject"]:{name:"Subject", type:"keyword", param:"subject", operator: "sb", equalityOperator: "=", uniqueValue: false},
["resultdescription"]:{name:"Description", type:"keyword", param:"description", operator: "ds", equalityOperator: "=", uniqueValue: false},
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", operator: "pb", equalityOperator: "=", uniqueValue: false},
["pid"]:{name:"PID", type:"keyword", param:"pid", operator: "pd", equalityOperator: " = ", uniqueValue: false},
["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", operator: "hs", equalityOperator: " exact ", uniqueValue: false},
["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", operator: "hs", equalityOperator: " exact ", uniqueValue: false},
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact ", uniqueValue: false},
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact ", uniqueValue: false},
["community"]:{name:"Community", type:"refine", param:"community", operator: "cm", equalityOperator: " exact ", uniqueValue: false},
["relproject"]:{name:"Project", type:"refine", param:"project", operator: "po", equalityOperator: " exact ", uniqueValue: false},
["relprojectid"]:{name:"Project", type:"entity", param:"project", operator: "po", equalityOperator: " exact ", uniqueValue: false},
["relfunder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact ", uniqueValue: false},
["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact ", uniqueValue: false},
["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact ", uniqueValue: false},
["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn0", equalityOperator: " exact ", uniqueValue: false},
["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", operator: "ya", equalityOperator: " exact ", uniqueValue: false},
["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", operator: "dt", equalityOperator: " within ", uniqueValue: false},
["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", operator: "ac", equalityOperator: " exact ", uniqueValue: false},
["collectedfrom"]:{name:"Collected From", type:"refine", param:"datasource", operator: "cl", equalityOperator: " exact ", uniqueValue: false},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", uniqueValue: false},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", uniqueValue: false}
};
//PROJECT
@ -52,23 +52,23 @@ export class SearchFields {
"projectstartdate","projectenddate","projectecsc39",
"projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
public PROJECT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", operator: "ar", equalityOperator: "="},
["projecttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "="},
["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", operator: "ky", equalityOperator: "="},
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", uniqueValue: false},
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", operator: "ar", equalityOperator: "=", uniqueValue: false},
["projecttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "=", uniqueValue: false},
["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", operator: "ky", equalityOperator: "=", uniqueValue: false},
["funder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact "},
["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact "},
["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact "},
["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn2", equalityOperator: " exact "},
["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", operator: "sy", equalityOperator: " exact "},
["projectendyear"]:{name:"End Year", type:"year", param:"endyear", operator: "ey", equalityOperator: " exact "},
["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", operator: "sd", equalityOperator: " within "},
["projectenddate"]:{name:"End Date", type:"date", param:"enddate", operator: "ed", equalityOperator: " within "},
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", operator: "sc", equalityOperator: " exact "},
["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", operator: "cd", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "}
["funder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact ", uniqueValue: false},
["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact ", uniqueValue: false},
["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact ", uniqueValue: false},
["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn2", equalityOperator: " exact ", uniqueValue: false},
["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", operator: "sy", equalityOperator: " exact ", uniqueValue: false},
["projectendyear"]:{name:"End Year", type:"year", param:"endyear", operator: "ey", equalityOperator: " exact ", uniqueValue: false},
["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", operator: "sd", equalityOperator: " within ", uniqueValue: false},
["projectenddate"]:{name:"End Date", type:"date", param:"enddate", operator: "ed", equalityOperator: " within ", uniqueValue: false},
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", operator: "sc", equalityOperator: " exact ", uniqueValue: false},
["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", operator: "cd", equalityOperator: " exact ", uniqueValue: false},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", uniqueValue: false},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", uniqueValue: false}
};
@ -81,22 +81,40 @@ export class SearchFields {
"datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", operator: "of", equalityOperator: "="},
["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", operator: "eg", equalityOperator: "="},
["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "="},
["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact "},
["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", operator: "cn", equalityOperator: " exact "},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", operator: "cm", equalityOperator: " exact "},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "="}
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", uniqueValue: false},
["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", operator: "of", equalityOperator: "=", uniqueValue: false},
["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", operator: "eg", equalityOperator: "=", uniqueValue: false},
["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "=", uniqueValue: false},
["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", uniqueValue: false},
["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", uniqueValue: false},
["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact ", uniqueValue: false},
["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact ", uniqueValue: false},
["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", operator: "cn", equalityOperator: " exact ", uniqueValue: false},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", operator: "cm", equalityOperator: " exact ", uniqueValue: false},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact ", uniqueValue: false},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", uniqueValue: false},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", uniqueValue: false},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", uniqueValue: false}
};
public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string} []= [
{"name": "relorganizationname", "equalityOperator": "="},
{"name": "relorganizationshortname", "equalityOperator": "="},
{"name": "datasourceofficialname", "equalityOperator": "="},
{"name": "datasourceenglishname", "equalityOperator": "="},
{"name": "datasourcetypename", "equalityOperator": " exact "},
{"name": "country", "equalityOperator": " exact "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
["datasourcetypeuiname"]:{name:"Repository type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", uniqueValue: true},
["country"]:{name:"Countries", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", uniqueValue: false},
["datasourceodsubjects"]:{name:"Subjects", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "=", uniqueValue: false},
["datasourceodcontenttypes"]:{name:"Content type", type:"refine", param:"content", operator: "cn", equalityOperator: " exact ", uniqueValue: false},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact ", uniqueValue: true},
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
@ -107,10 +125,10 @@ export class SearchFields {
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","country"];
public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator:"op", equalityOperator: "="},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", operator: "nm", equalityOperator: "="},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", operator: "so", equalityOperator: "="},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "="},
["q"]:{name:"All fields", type:"keyword", param:"q", operator:"op", equalityOperator: "=", uniqueValue: false},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", operator: "nm", equalityOperator: "=", uniqueValue: false},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", operator: "so", equalityOperator: "=", uniqueValue: false},
["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", uniqueValue: false},
};
// public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
// public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
@ -153,6 +171,24 @@ export class SearchFields {
return "UNDEFINED";
}
}
fieldHasUniqueValue(fieldId:string,fieldType:string,usedBy:string="search"):boolean{
if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other"){
return this.RESULT_FIELDS[fieldId].uniqueValue;
}else if(fieldType == "project"){
return this.PROJECT_FIELDS[fieldId].uniqueValue;
}else if(fieldType == "organization"){
return this.ORGANIZATION_FIELDS[fieldId].uniqueValue;
}else if(fieldType == "datasource" || fieldType == "dataprovider"){
if(usedBy == "search") {
return this.DATASOURCE_FIELDS[fieldId].uniqueValue;
} else if(usedBy == "deposit") {
return this.DEPOSIT_DATASOURCE_FIELDS[fieldId].uniqueValue;
}
}else{
return false;
}
}
}
export class FieldDetails{
name:string;
@ -160,4 +196,5 @@ export class FieldDetails{
param:string;
equalityOperator:string;
operator:string;
uniqueValue: boolean = false;
}