[Library|Trunk]

Search:
	old datsource search pages & table view: remove map link

	new Datasource search page: 
		able to use it for different types (compatible, journal, registries)
		create a helper class for selecting proper query, filter, etc depending on the type
	
	Advanced form:
		remove [()] from html attributes	
		add check about showing advanced link & entites selection component
		when only one advanced filed is left, change its operator to and
		update according to the new UI
		Autocomplete: on blur clear keyword
	New Search PAge:
		Handle Quotted queries for field with equality operator "="


		
		
		


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58138 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-02-25 15:40:56 +00:00
parent 6bf56acf93
commit 6e7a46b7a9
16 changed files with 331 additions and 96 deletions

View File

@ -76,7 +76,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToCompatibleDataProviders
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.searchPage.refineFields = this.refineFields;

View File

@ -67,7 +67,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProvidersTable;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;

View File

@ -77,7 +77,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.searchPage.refineFields = this.refineFields;

View File

@ -59,7 +59,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToEntityRegistriesDataProviders;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=registries";
});
this.refineFields.push("datasourcecountryname");
this.searchPage.refineFields = this.refineFields;

View File

@ -78,7 +78,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournals;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;

View File

@ -68,7 +68,7 @@ properties:EnvProperties;
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.baseUrl = data.envSpecific.searchLinkToJournalsTable;
this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
// this.mapUrl = this.properties.statisticsFrameAPIURL+"markers-test.html?show=journals";
});
this.searchPage.refineFields = this.refineFields;
this.sub = this.route.queryParams.subscribe(params => {

View File

@ -9,6 +9,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl
import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
@Component({
@ -16,7 +17,7 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
template: `
<new-search-page
pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ 'content providers' | titlecase }}"
pageTitle="{{(simpleView?'':'Advanced ')}} Search for {{ pageTitle }}"
entityType="dataprovider"
type="content providers"
[results]="results"
@ -31,10 +32,10 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component";
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
searchFormClass="datasourcesSearchForm"
[entitiesSelection]="type=='all'" [showAdvancedSearchLink]="type=='all'"
[filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by title, country, organization, subject, type..."
>
[showResultCount]="type!='registries'">
</new-search-page>
`
@ -62,8 +63,9 @@ export class SearchDataProvidersComponent {
public pagingLimit: number = 0;
public isPiwikEnabled;
properties:EnvProperties;
public refineFields: string[] = this.searchFields.DATASOURCE_REFINE_FIELDS;
@Input() type: "all" | "registries" | "journals" | "compatible" ="all";
public refineFields: string[] = DatasourcesHelperClass.getrefineFields(this.type);
pageTitle = DatasourcesHelperClass.getTitle(this.type);
@ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
@Input() simpleView: boolean = true;
@Input() simpleSearchLink: string = "";
@ -86,7 +88,7 @@ export class SearchDataProvidersComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties= data.envSpecific;
if (!this.simpleSearchLink) {
this.simpleSearchLink = this.properties.searchLinkToProjects;
this.simpleSearchLink = this.properties.searchLinkToDataProviders;
} this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
this.pagingLimit = data.envSpecific.pagingLimit;
@ -94,8 +96,9 @@ export class SearchDataProvidersComponent {
});
var firstLoad = true;
this.sub = this.route.queryParams.subscribe(params => {
let firstLoad = true;
this.filters = DatasourcesHelperClass.createFilters(this.type);
this.sub = this.route.queryParams.subscribe(params => {
this.loadPaging = true;
if(params['page'] && this.searchUtils.page != params['page']) {
this.loadPaging = false;
@ -117,11 +120,6 @@ export class SearchDataProvidersComponent {
this.searchPage.fieldIds = this.fieldIds;
this.selectedFields =[];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
// this.searchPage.selectedFields = this.selectedFields;
// this.searchPage.fieldIdsMap = this.fieldIdsMap;
// this.searchPage.customFilter = this.customFilter;
// this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
});
}
@ -154,12 +152,13 @@ export class SearchDataProvidersComponent {
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and ':'') + parameters, page, size, this.properties, (refine && this.type=="all") ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
data => {
this.searchUtils.totalResults = data[0];
this.results = data[1];
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(data[2]);
this.filters = this.searchPage.prepareFiltersToShow(this.type=="all"?data[2]:this.filters);
}else{
this.searchPage.buildPageURLParameters(this.filters, [], false);
}

View File

@ -11,7 +11,8 @@
</div>
</div>
<form *ngIf="!simpleView"
[class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-padding-small':'advancedSearchForm uk-tile uk-padding-small'">
[class]="((isDisabled )?'uk-disabled ':'')
+' advancedSearchForm uk-tile uk-padding-small uk-margin-medium-bottom'">
<div>
@ -19,29 +20,37 @@
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties"
></quick-selections>
<table class=" uk-table uk-table-responsive uk-table-small">
<hr *ngIf="resultTypes || quickFilter">
<table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove">
<tr>
<td class="uk-text-muted uk-text-uppercase">Field to search</td>
<td class="uk-text-muted uk-text-uppercase">Term</td>
</tr>
<tr *ngFor="let selectedField of selectedFields; let i = index" class="-row ">
<td *ngIf="i==0 " class="">Search for:</td>
<td *ngIf="i != 0" class=""><select [(ngModel)]="selectedField.operatorId" name="selectOp_{{i}}">
<option *ngFor="let op of operators" (change)="fieldOperatorChanged(i, op.id, op.id)"
(click)="fieldOperatorChanged(i, op.id, op.id)" [value]="op.id">{{op.id}}</option>
</select></td>
<td><select [(ngModel)]="selectedField.id" name="selectField_{{i}}"
(ngModelChange)="fieldIdsChanged(i,selectedField.id)"><!--(click)="fieldIdsChanged(i)" -->
<option *ngFor="let id of fieldIds" [value]="id">{{fieldIdsMap[id].name}} </option>
</select></td>
<td *ngIf="selectedField.type == 'keyword'"><input type="text" class="form-control"
placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]"></td>
<td *ngIf="selectedField.type == 'keyword'">
<div class="uk-inline">
<a *ngIf="selectedField.value.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="selectedField.value = ''"
uk-icon="icon: close"></a>
<input type="text" class="form-control"
placeholder="Type keywords..."
[(ngModel)]="selectedField.value" name="value[{{i}}]">
</div>
</td>
<td *ngIf="selectedField.type == 'date'">
<date-filter [(dateValue)]=selectedField.dateValue [(validDateFrom)]=validDateFrom
[(validDateTo)]=validDateTo></date-filter>
<date-filter [dateValue]=selectedField.dateValue [validDateFrom]=validDateFrom
[validDateTo]=validDateTo></date-filter>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'vocabulary'">
<static-autocomplete [(properties)]=properties *ngIf=" selectedField.id" [(vocabularyId)]=selectedField.param
<static-autocomplete [properties]=properties *ngIf=" selectedField.id" [vocabularyId]=selectedField.param
[fieldId]=selectedField.id
[(list)]=this.fieldList[selectedField.id] [entityName]="entityType"
[list]=this.fieldList[selectedField.id] [entityName]="entityType"
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
@ -49,7 +58,7 @@
(listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
</td>
<td *ngIf=" selectedField.id && selectedField.type == 'refine'" class="uk-width-1-3">
<static-autocomplete [(properties)]=properties [(list)]=this.fieldList[selectedField.id]
<static-autocomplete [properties]=properties [list]=this.fieldList[selectedField.id]
[fieldId]=selectedField.id [entityName]="entityType" [fieldName]=[selectedField.id]
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
@ -57,7 +66,7 @@
(listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
</td>
<td *ngIf="selectedField.type == 'entity'">
<entities-autocomplete [(properties)]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
<entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
[selectedValue]=selectedField.value [showSelected]=true
[placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
[multipleSelections]=false
@ -76,21 +85,30 @@
value="false">No<br>
</span>
</td>
<td style="min-width: 75px;"><select *ngIf="i+1 <selectedFields.length"
[(ngModel)]="selectedField.operatorId"
name="selectOp_{{i}}">
<option *ngFor="let op of operators" (change)="fieldOperatorChanged(i, op.id, op.id)"
(click)="fieldOperatorChanged(i, op.id, op.id)" [value]="op.id">{{op.id}}</option>
</select>
<div *ngIf="i == selectedFields.length-1 " class=" uk-text-right" style="margin-top: 55px;">
<span class="uk-text-muted uk-text-uppercase uk-margin-small-right " > Add rule</span>
</div>
</td>
<td class=" ">
<span type="button" class="uk-icon-button icon-button-small"
<span type="button" class="uk-icon-button portal-button-reverse "
(click)="removeField(i)">
<span class=""><svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="minus" ratio="0.8"><rect height="1" width="18" y="9"
x="1"></rect></svg></span>
<span uk-icon="minus"> </span>
</span>
<span *ngIf="i == selectedFields.length-1 " type="button" class="uk-icon-button icon-button-small"
<div *ngIf="i == selectedFields.length-1 " class="uk-margin-small-top">
<span type="button"
class="uk-icon-button portal-button "
(click)="addField()">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus"
ratio="0.8"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17"
height="1"></rect></svg>
<span uk-icon="plus">
</span>
</span></td>
</span>
</div>
</td>
</tr>
</table>
<div class=" uk-text-center">
@ -103,19 +121,18 @@
<div *ngIf="!validDateFrom && !validDateTo" class="uk-text-danger">
Please check your dates
</div>
<button (click)="queryChanged()" type="submit"
class=" uk-button uk-padding uk-padding-remove-top uk-padding-remove-bottom portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom "> Search
</button>
</div>
<button (click)="queryChanged()" type="submit"
class=" uk-button uk-padding uk-padding-remove-top uk-padding-remove-bottom portal-button uk-padding uk-padding-remove-top uk-padding-remove-bottom " style="position: absolute;bottom: -19px;left: 45%;"> Search
</button>
</div>
</form>
<div *ngIf="simpleView">
<form class=" uk-margin-medium-bottom uk-margin-top ">
<div class="uk-grid">
<div>
<entities-selection [simpleView]="true" [currentEntity]="entityType"
<div [class]="(entitiesSelection)?'':'uk-width-medium@m uk-width-small@s'">
<entities-selection *ngIf="entitiesSelection" [simpleView]="true" [currentEntity]="entityType"
[properties]="properties"
(selectionChange)=" simpleEntityChanged($event)"></entities-selection>
</div>
@ -124,7 +141,7 @@
<a *ngIf="selectedFields[0].value.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="selectedFields[0].value = ''"
uk-icon="icon: close"></a>
<input type="text" class="uk-input uk-width-xlarge@l uk-width-medium@m uk-width-auto"
<input type="text" class="uk-input uk-width-xlarge@l uk-width-large@m uk-width-medium"
[placeholder]="formPlaceholderText" aria-describedby="sizing-addon2"
[(ngModel)]="selectedFields[0].value" name="keyword">
</div>
@ -140,7 +157,7 @@
class=" uk-button portal-button uk-margin-small-left uk-text-bold uk-padding uk-padding-remove-top uk-padding-remove-bottom">
Search
</button>
<div class="uk-margin-small-top">
<div class="uk-margin-small-top" *ngIf="showAdvancedSearchLink">
<a *ngIf ="this.entityType == this.selectedEntity && advancedSearchLink" routerLinkActive="router-link-active"
[routerLink]="advancedSearchLink" style="z-index:1;" [queryParams]="advancedSearchLinkParameters"
[class]="(isDisabled)?' uk-disabled uk-link-muted portal-link uk-margin-left ':' portal-link uk-margin-left '">Advanced search

View File

@ -38,6 +38,8 @@ export class AdvancedSearchFormComponent {
selectedEntity;
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
@Input() entitiesSelection:boolean;
@Input() showAdvancedSearchLink:boolean = true;
constructor (private route: ActivatedRoute, private router: Router) {
}
@ -112,6 +114,10 @@ export class AdvancedSearchFormComponent {
}else{
this.selectedFields.splice(index, 1);
}
//if only one filter left, set the operator to and
if(this.selectedFields.length==1){
this.selectedFields[0].operatorId = "and";
}
}
fieldOperatorChanged(index: number, operatorId: string, operatorName: string) {

View File

@ -0,0 +1,178 @@
import {Filter, Value} from "./searchHelperClasses.class";
import {SearchFields} from "../../utils/properties/searchFields";
export class DatasourcesHelperClass {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible") {
let searchFields:SearchFields = new SearchFields();
if (type == "registries") {
return searchFields.ENTITY_REGISTRIES_FIELDS;
} else if (type == "journals") {
return searchFields.JOURNAL_FIELDS;
} else if (type == "compatible") {
return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
} else {
return searchFields.DATASOURCE_REFINE_FIELDS;
}
}
public static getTitle(type: "all" | "registries" | "journals" | "compatible") {
if (type == "registries") {
return "Entity Registries"
} else if (type == "journals") {
return "Journals"
} else if (type == "compatible") {
return "Compatible Content Providers";
} else {
return "Content Providers"
}
}
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible"): string {
if (type == "registries") {
return ' datasourcetypeuiid = other ';
} else if (type == "journals") {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
} else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
} else {
return "";
}
}
public static createFilters(type: "all" | "registries" | "journals" | "compatible"): Filter[] {
if (type == "registries") {
return this.createRegistriesFilters();
} else if (type == "journals") {
return this.createJournalFilters();
} else if (type == "compatible") {
return this.createCompatibleFilters();
} else {
return [];
}
}
private static createCompatibleFilters(): Filter[] {
var filter_names = ["Type", "Compatibility Level"];
var filter_ids = ["datasourcetypeuiid", "datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
var value_names = [
[
"Institutional Repository", "Thematic Repository", "Publication Repository",
"Institutional Repository Aggregator",
"Thematic Repository Aggregator", "Publication Repository Aggregator",
"Data Repository", "Data Repository Aggregator", "CRIS System", "Publication Catalogue",
"Software Repository", "Software Repository Aggregator"],
["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids = [
["pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional", "aggregator::pubsrepository::thematic", "aggregator::pubsrepository::unknown",
"datarepository::unknown", "aggregator::datarepository", "crissystem", "pubscatalogue::unknown", "softwarerepository", "aggregator::softwarerepository"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] = [];
for (var i = 0; i < filter_names.length; i++) {
var values: Value[] = [];
for (var j = 0; j < value_names[i].length; j++) {
var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, 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,
filterType: "checkbox"
};
filters.push(filter);
}
return filters;
}
private static createRegistriesFilters(): Filter[] {
var filter_names = ["Type", "Compatibility Level"];
var filter_ids = ["datasourcetypename", "datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
var value_names = [
["Funder", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"],
["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids = [
["Funder database", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"],
//["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] = [];
for (var i = 0; i < filter_names.length; i++) {
var values: Value[] = [];
for (var j = 0; j < value_names[i].length; j++) {
var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, 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,
filterType: "checkbox"
};
filters.push(filter);
}
return filters;
}
private static createJournalFilters():Filter[] {
var filter_names=["Type","Compatibility Level"];
var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
var searchFields = new SearchFields();
var filter_original_ids = searchFields.JOURNAL_FIELDS;
var value_names=[
/*[
"Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
"Institutional Repositories Aggregators",
"Thematic Repositories Aggregators", "Other Repositories Aggregators",
"Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
*/
["Journal", "Journal Aggregator\/Publisher"],
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var value_original_ids=[
["pubsrepository::journal", "aggregator::pubsrepository::journals"],
//["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE Data (funded, referenced datasets)",
"collected from a compatible aggregator", "proprietary", "under validation"]];
var filters: Filter[] =[];
for(var i =0 ; i < filter_names.length;i++){
var values:Value[] = [];
for(var j =0 ; j < value_names[i].length;j++){
var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:0, 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, filterType: "checkbox" };
filters.push(filter);
}
return filters;
}
}

View File

@ -18,7 +18,8 @@
[advancedSearchLinkParameters]
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
[pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
[resultTypes]="resultTypes" [quickFilter]="quickFilter"
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
[showAdvancedSearchLink]="showAdvancedSearchLink"
>
</advanced-search-form>
</div>

View File

@ -86,6 +86,7 @@ export class NewSearchPageComponent {
url = null;
@Input() entitiesSelection:boolean = true;
@Input() showAdvancedSearchLink:boolean = true;
constructor(private route: ActivatedRoute,
private location: Location,
private _meta: Meta,
@ -617,13 +618,16 @@ export class NewSearchPageComponent {
} else {
//Remove quotes from keyword search
// params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " ";
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + StringUtils.URIEncode(this.selectedFields[i].value) + " ";
// params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + StringUtils.URIEncode(this.selectedFields[i].value) + " ";
params += this.createQuotedKeywordQuery(this.selectedFields[i],countParams,true);
}
// params += (countParams == 0 ? "" : this.selectedFields[i].operatorId) + " " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " ";
} else if (countParams == 0 && this.selectedFields[i].operatorId == "not") {
} else if (countParams == 0 && this.selectedFields[i].operatorId == "not" && this.fieldIdsMap[this.selectedFields[i].id].equalityOperator != "=") {
params += " " + this.selectedFields[i].id + " <> " + '"' + StringUtils.URIEncode(this.selectedFields[i].value) + '"' + " ";
} else {
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
} else if(this.fieldIdsMap[this.selectedFields[i].id].equalityOperator == "=") {
params+=this.createQuotedKeywordQuery(this.selectedFields[i], countParams, false);
}else{
params += (countParams == 0 ? "" : this.selectedFields[i].operatorId + " ") + this.selectedFields[i].id + this.fieldIdsMap[this.selectedFields[i].id].equalityOperator + '"' + encodeURIComponent(this.selectedFields[i].value) + '"' + " ";
}
}
@ -634,9 +638,66 @@ export class NewSearchPageComponent {
if (this.customFilter) {
params += (countParams == 0 ? "" : " and ") + this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId));
}
console.log("ParameterS:")
console.log(params)
return params;
}
createQuotedKeywordQuery(field:AdvancedField, countParams:number, isSearchAll:boolean){
console.log(field)
let params = "";
let quotedParts = (field.value)?field.value.match(/(["'])(.*?)*?\1/g):[];
console.log(quotedParts)
params+= (countParams == 0 ? "" : field.operatorId) + " (";
if(quotedParts && quotedParts.length == 1 && quotedParts[0] == field.value ){
params+=this.getQuotedQueryPart(field.id, field.value,isSearchAll);
}else if( quotedParts && quotedParts.length > 0){
for(let i=0; i< quotedParts.length; i++){
params+=(i>0)?" and ":"";
params+=this.getQuotedQueryPart(field.id, quotedParts[i],isSearchAll);
}
let startPoint = 0;
let endPoint = 0;
for(let i=0; i< quotedParts.length; i++){
let index = field.value.indexOf(quotedParts[i]);
endPoint = (i+1<quotedParts.length)? field.value.indexOf(quotedParts[i+1]):field.value.length;
// console.log(field.value.indexOf(quotedParts[i+1]) +" - "+field.value.length);
// console.log(" SP "+ startPoint+" EP: "+endPoint);
if(index==startPoint){
startPoint +=quotedParts[i].length;
}else if(startPoint < index){
endPoint = index;
}
// console.log(" SP "+ startPoint+" EP: "+endPoint);
if(decodeURIComponent(field.value.substring(startPoint,endPoint)).split(" ").join("").length > 0) {
params += " and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint, endPoint), isSearchAll);
}
// console.log("For "+i+" " +params+" SP "+ startPoint+" EP: "+endPoint);
// startPoint = (i+1<quotedParts.length)? field.value.indexOf(quotedParts[i+i]):field.value.length;//(startPoint<index )?(index + quotedParts[i].length):field.value.length;
startPoint = ((i+1<quotedParts.length)?(field.value.indexOf(quotedParts[i+1])+quotedParts[i+1].length):(endPoint== index?(index+quotedParts[i].length):endPoint));
console.log(" Next SP "+ startPoint);
}
if(startPoint !=field.value.length && decodeURIComponent(field.value.substring(startPoint,field.value.length)).split(" ").join("").length > 0){
params+=" and " + this.getNoQuotedQueryPart(field.id, field.value.substring(startPoint,field.value.length),isSearchAll);
}
}else{
params+=this.getNoQuotedQueryPart(field.id, field.value,isSearchAll);
}
params += " )";
return params;
}
private getQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
return " ("+(isSearchAll?"__all":fieldId)+" exact "+StringUtils.URIEncode(value)+")";
}
private getNoQuotedQueryPart(fieldId:string, value:string, isSearchAll:boolean){
if(isSearchAll){
return " (" + value + ")"
}else{
return " ("+fieldId+"="+ StringUtils.URIEncode(value)+")";
}
}
/**
* Create Search API query based on the filters of refine fields
* @param URLparams
@ -848,14 +909,7 @@ export class NewSearchPageComponent {
* @param rangeFilters defined by the URL parameters
* @param includePage
*/
//<<<<<<< .mine
buildPageURLParameters(filters:Filter[], rangeFilters: RangeFilter[], includePage: boolean) {
//console.log("buildPageURLParameters");
// ||||||| .r58066
// buildPageURLParameters(filters:Filter[],includePage: boolean) {
// =======
// buildPageURLParameters(filters: Filter[], includePage: boolean) {
// >>>>>>> .r58095
this.parameterNames.splice(0, this.parameterNames.length);
this.parameterValues.splice(0, this.parameterValues.length);
var fields: { [key: string]: { values: string[], operators: string[] } } = {};
@ -1160,7 +1214,6 @@ export class NewSearchPageComponent {
* @param customFilter
* @param params
*/
//<<<<<<< .mine
prepareSearchPage(fieldIds, selectedFields, refineFields, rangeFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null){
//console.log("prepareSearchPage");
this.entityType = entityType;
@ -1174,26 +1227,5 @@ export class NewSearchPageComponent {
this.getRangeFiltersFromURL(params);
this.getRefineFiltersFromURL(params);
this.createAdvancedSearchSelectedFiltersFromURLParameters(params);
// ||||||| .r58066
// prepareSearchPage(fieldIds, selectedFields, refineFields,fieldIdsMap, customFilter, params){
// this.fieldIds = fieldIds;
// this.selectedFields = selectedFields;
// this.refineFields = refineFields;
// this.fieldIdsMap = fieldIdsMap;
// this.customFilter = customFilter;
// this.getRefineFiltersFromURL(params);
// this.createAdvancedSearchSelectedFiltersFromURLParameters(params);
// =======
// prepareSearchPage(fieldIds, selectedFields, refineFields, fieldIdsMap, customFilter, params, entityType, quickFilter=null) {
// this.entityType = entityType;
// this.fieldIds = fieldIds;
// this.selectedFields = selectedFields;
// this.refineFields = refineFields;
// this.fieldIdsMap = fieldIdsMap;
// this.customFilter = customFilter;
// this.quickFilter = quickFilter;
// this.getRefineFiltersFromURL(params);
// this.createAdvancedSearchSelectedFiltersFromURLParameters(params);
}
//>>>>>>> .r58095
}

View File

@ -152,7 +152,8 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
private getDescription(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null);
if (!item) return null;
return [(item.substring(0,4997)+(item.substring(0,4997).length == 4997?'...':'')) as String];
let descr = Array.isArray(item) ? item[0]:item;
return [(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')) as String];
}
private getDateCreated(result: any): String[] {

View File

@ -26,7 +26,7 @@ import{EnvProperties} from '../properties/env-properties';
</span> </div>
</div>
</div>
<input *ngIf = "showInput" type="text" class="auto-complete-input validate filter-input input-sm form-control -width-small " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=search() >
<input *ngIf = "showInput" type="text" class="auto-complete-input validate filter-input input-sm form-control -width-small " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=search() (blur)="keyword = ''" >
<!--span [style.display]="showLoading ? 'inline' : 'none'" class="uk-alert uk-alert-primary" data-uk-alert=""> <i class="uk-icon-spinner"></i> Loading... </span>
<span *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" data-uk-alert=""> {{warningMessage}} <a href="" class="uk-alert-close uk-close"></a></span-->
<div *ngIf="focus && showInput" class="uk-dropdown" aria-expanded="true" style="display:block" >

View File

@ -17,7 +17,8 @@
[(ngModel)]="filter.selectedToValue" name="yearTo" #yearTo="ngModel" inValidYear
placeholder="e.g. 2020"/>
<button type="submit" (click)="yearChanged()"
[ngStyle]="{'cursor': rangeForm.valid ? 'pointer' : 'not-allowed'}" class="uk-icon uk-width-1-6 uk-text-right"
[ngStyle]="{'cursor': rangeForm.valid ? 'pointer' : 'not-allowed'}"
class="uk-icon uk-icon-button uk-margin-small-left uk-text-right uk-button-default"
[disabled]="rangeForm.invalid">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="chevron-right" ratio="1">

View File

@ -22,7 +22,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
</div>
</div>
</div>
<input *ngIf = "showInput " type="text" class="auto-complete-input validate filter-input input-sm form-control -width-small " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=filter() >
<input *ngIf = "showInput " type="text" class="auto-complete-input validate filter-input input-sm form-control -width-small " [placeholder]=placeHolderMessage [(ngModel)]=keyword (keyup)=filter() (blur)="keyword = ''" >
<!--span [style.display]="showLoading ? 'inline' : 'none'" class="uk-alert uk-alert-primary" data-uk-alert=""> <i class="uk-icon-spinner"></i> Loading... </span>
<span *ngIf="warningMessage.length > 0" class="uk-alert uk-alert-warning" data-uk-alert=""> {{warningMessage}} <a href="" class="uk-alert-close uk-close"></a></span-->
<div *ngIf="focus && showInput" class="uk-dropdown" aria-expanded="true" style="display:block" >