[Library|Trunk]

New Search pages:
	1. update queries to use new method in API /resources2?type={publications,datasets,software,other,projects,organizations, datasources}
	2. add Entities Selection component and add it Simple, Advanced pages
	3. Quick Selections update: add check for enabled entities 
	4. Update simple search form and advanced according to the mocks



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58093 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-02-13 14:44:51 +00:00
parent cce694ca7f
commit 9da07c3568
15 changed files with 288 additions and 100 deletions

View File

@ -198,9 +198,6 @@ public resourcesQuery = "(oaftype exact organization)";
);
}
}
private setFilters(){
//TODO set filters from
}
private handleError(message: string, error) {
console.error("Organizations advanced Search Page: "+message, error);

View File

@ -76,6 +76,7 @@ export class SearchResearchResultsComponent {
filterId: "resultbestaccessright",
value: "Open Access"
};
constructor(private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService) {
this.results = [];
this.errorCodes = new ErrorCodes();
@ -84,6 +85,8 @@ export class SearchResearchResultsComponent {
}
ngOnInit() {
console.log(this.quickFilter)
//TODO add checks about which result types are enabled!
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.pagingLimit = data.envSpecific.pagingLimit;
@ -121,7 +124,7 @@ export class SearchResearchResultsComponent {
}
this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params, this.resultType);
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter);
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
@ -139,7 +142,6 @@ export class SearchResearchResultsComponent {
size = 0;
}
if (page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
// TODO update the following method to get more than one types
if (parameters != null && parameters != '') {
this.csvParams = "&fq=(" + this.resourcesQuery + " and (" + parameters + "))";
} else {
@ -151,7 +153,6 @@ export class SearchResearchResultsComponent {
this.disableForms = true;
this.results = [];
this.searchUtils.totalResults = 0;
// TODO update the following method to get more than one types
this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe(
data => {
this.searchUtils.totalResults = data[0];

View File

@ -1,18 +1,23 @@
<form
[class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-margin-small-top uk-padding-small':'advancedSearchForm uk-tile uk-margin-small-top uk-padding-small'">
<div *ngIf="!simpleView">
<div class="uk-article-title custom-article-title uk-text-center">
{{pageTitle}}
</div>
<a *ngIf="simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active"
[routerLink]=simpleSearchLink style="z-index:1;"
[class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Simple search
<!--span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span-->
</a>
<div *ngIf="!simpleView">
<a *ngIf="simpleSearchLink && simpleSearchLink.length > 0" routerLinkActive="router-link-active"
[routerLink]=simpleSearchLink style="z-index:1;"
[class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Quick search
</a>
<div class="uk-h5 uk-margin-small-bottom">
Advanced search in
<entities-selection [simpleView]="false" [currentEntity]="entityType"
[properties]="properties"></entities-selection>
</div>
</div>
<form *ngIf="!simpleView"
[class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-padding-small':'advancedSearchForm uk-tile uk-padding-small'">
<div>
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties"
></quick-selections>
<table class=" uk-table uk-table-responsive uk-table-small">
<tr *ngFor="let selectedField of selectedFields; let i = index" class="-row ">
@ -78,12 +83,6 @@
icon="minus" ratio="0.8"><rect height="1" width="18" y="9"
x="1"></rect></svg></span>
</span>
<!-- <span *ngIf="selectedFields.length == 1" type="button" class="uk-icon-button icon-button-small" disabled>-->
<!-- <span class="uk-icon">-->
<!-- <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>-->
<span *ngIf="i == selectedFields.length-1 " type="button" class="uk-icon-button icon-button-small"
(click)="addField()">
<span class="uk-icon">
@ -106,27 +105,53 @@
</div>
<button (click)="queryChanged()" type="submit"
class=" uk-button uk-padding uk-padding-remove-top uk-padding-remove-bottom ">
<span class="uk-icon"><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="search" ratio="1.5"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9"
cy="9" r="7"></circle><path fill="none"
stroke="#000"
stroke-width="1.1"
d="M14,14 L18,18 L14,14 Z"></path></svg></span>
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>
</div>
<div *ngIf="simpleView">
<a routerLinkActive="router-link-active"
[routerLink]="advancedSearchLink" style="z-index:1;" [queryParams]="advancedSearchLinkParameters"
[class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Advanced search
</a>
<search-form *ngIf="selectedFields.length > 0" [isDisabled]="isDisabled" [(keyword)]="selectedFields[0].value"
(keywordChange)="simpleKeywordChanged($event)"
[placeholderText]="formPlaceholderText"></search-form>
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null">
</quick-selections>
</div>
</form>
<div *ngIf="simpleView">
<form class=" uk-margin uk-margin-top ">
<div class="uk-grid">
<div>
<entities-selection [simpleView]="true" [currentEntity]="entityType"
[properties]="properties"
(selectionChange)=" simpleEntityChanged($event)"></entities-selection>
</div>
<div [class]="((resultTypes || quickFilter)?'quickSelectionsBox':'')+' uk-padding-remove-left'">
<div class="uk-inline">
<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"
[placeholder]="formPlaceholderText" aria-describedby="sizing-addon2"
[(ngModel)]="selectedFields[0].value" name="keyword">
</div>
<div>
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties">
</quick-selections>
</div>
</div>
<div class="uk-padding-remove-left">
<button (click)="simpleKeywordChanged(null)" type="submit"
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">
<a *ngIf ="this.entityType == this.selectedEntity" 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
</a>
<a *ngIf ="this.entityType != this.selectedEntity" routerLinkActive="router-link-active"
[routerLink]="selectedEntityAdvancedUrl" style="z-index:1;"
[queryParams]="{q:this.selectedFields[0].value,op:'and'}"
[class]="(isDisabled)?' uk-disabled uk-link-muted portal-link uk-margin-left ':' portal-link uk-margin-left '">Advanced search
</a>
</div>
</div>
</div>
</form>
</div>

View File

@ -1,10 +1,11 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {ActivatedRoute, Router} from '@angular/router';
import {AdvancedField, Filter} from '../searchUtils/searchHelperClasses.class';
import {SearchFields} from '../../utils/properties/searchFields';
import {Dates} from '../../utils/string-utils.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {ConfigurationService} from "../../utils/configuration/configuration.service";
@Component({
selector: 'advanced-search-form',
@ -34,12 +35,15 @@ export class AdvancedSearchFormComponent {
public searchFields:SearchFields = new SearchFields();
properties:EnvProperties;
public operators: {name:string, id:string}[] = this.searchFields.ADVANCED_SEARCH_OPERATORS;
constructor (private route: ActivatedRoute) {
selectedEntity;
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
constructor (private route: ActivatedRoute, private router: Router) {
}
ngOnInit() {
this.selectedEntity = this.entityType;
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
@ -51,12 +55,20 @@ export class AdvancedSearchFormComponent {
this.newFieldId = this.fieldIds[0];
this.newFieldName = this.fieldIdsMap[this.newFieldId].name;
}
simpleEntityChanged($event){
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl;
}
simpleKeywordChanged($event){
this.selectedFields[0].value = $event.value;
this.queryChanged();
// this.selectedFields[0].value = $event.value;
if(this.selectedEntity == this.entityType) {
this.queryChanged();
}else{
this.router.navigate([this.selectedEntitySimpleUrl], {queryParams:{q:this.selectedFields[0].value,op:"and"}});
}
}
queryChanged() {
console.log("Q CHanged!")
this.validDateFrom = true;
this.validDateTo = true;

View File

@ -9,11 +9,12 @@ import {StaticAutocompleteModule} from '../../utils/staticAutoComplete/staticAut
import {DateFilterModule} from './dateFilter.module';
import {SearchFormModule} from './searchForm.module';
import {QuickSelectionsModule} from "./quick-selections.module";
import {EntitiesSelectionModule} from "./entitiesSelection.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule, QuickSelectionsModule
CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule, QuickSelectionsModule, EntitiesSelectionModule
],
declarations: [
AdvancedSearchFormComponent,

View File

@ -0,0 +1,104 @@
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {FormBuilder} from "@angular/forms";
import {EnvProperties} from "../../utils/properties/env-properties";
import {SearchCustomFilter} from "./searchUtils.class";
import {ConfigurationService} from "../../utils/configuration/configuration.service";
import {RouterHelper} from "../../utils/routerHelper.class";
import {Router} from "@angular/router";
@Component({
selector: 'entities-selection',
template: `
<select *ngIf="show" [(ngModel)]="selectedEntity" class="uk-select uk-width-auto portal-box uk-text-small" (ngModelChange)="entityChanged()" >
<option *ngIf="simpleView && (showResearchOutcomes + showDataProviders + showOrganizations + showProjects )>1 " value="all">All content</option>
<option *ngIf="showResearchOutcomes" value="result">Research outcomes</option>
<option *ngIf="showProjects" value="project">Projects</option>
<option *ngIf="showDataProviders" value="content provider">Content providers</option>
<option *ngIf="showOrganizations" value="organization">Organizations</option>
</select>
<button *ngIf="!show && currentEntity" class="uk-select uk-width-auto portal-box uk-text-small">
<span *ngIf="currentEntity=='all'">All content</span>
<span *ngIf="currentEntity=='result'">Research outcomes</span>
<span *ngIf="currentEntity=='project'">Projects</span>
<span *ngIf="currentEntity=='dataprovider'">Content providers</span>
<span *ngIf="currentEntity=='organization'">Organizations</span>
</button>
`
})
export class EntitiesSelectionComponent {
showResearchOutcomes: boolean = false;
showProjects: boolean = false;
showDataProviders: boolean = false;
showOrganizations: boolean = false;
@Input() properties: EnvProperties;
@Input() customFilter: SearchCustomFilter = null;
@Input() @Output() selectedEntity = "Research Outcomes";
@Input() currentEntity = "Research Outcomes";
@Input() simpleView:boolean = true;
@Input() onChangeNavigate:boolean = true;
@Output() selectionChange = new EventEmitter();
show = false;
constructor(private _fb: FormBuilder, private config: ConfigurationService, private router: Router) {
}
ngOnInit() {
if(this.properties) {
this.config.getCommunityInformation(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communitId") ? this.customFilter.valueId : this.properties.adminToolsCommunity).subscribe(data => {
var showEntity = {};
for (var i = 0; i < data['entities'].length; i++) {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
this.showResearchOutcomes = showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"];
this.showProjects = showEntity["project"];
this.showOrganizations = showEntity["organization"];
this.showDataProviders = showEntity["datasource"];
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
this.showProjects = false;
this.showOrganizations = false;
this.showDataProviders = false;
}
this.show = true;
});
}
this.selectedEntity = this.currentEntity;
this.selectionChange.emit({entity:this.selectedEntity, simpleUrl:this.getUrl(true) , advancedUrl:this.getUrl(false)});
}
entityChanged(){
if(!this.simpleView){
this.router.navigate([this.getUrl(false)]);
}else{
this.selectionChange.emit({entity:this.selectedEntity, simpleUrl:this.getUrl(true) , advancedUrl:this.getUrl(false)});
}
}
getUrl(simpleView:boolean){
let url = "";
if(this.selectedEntity == "all"){
url = "/search/find/";
}else if(this.selectedEntity == "result"){
url = (simpleView?this.properties.searchLinkToResults:this.properties.searchLinkToAdvancedResults);
}else if(this.selectedEntity == "project"){
url = (simpleView?this.properties.searchLinkToProjects:this.properties.searchLinkToAdvancedProjects);
}else if(this.selectedEntity == "content provider"){
url = (simpleView?this.properties.searchLinkToDataProviders:this.properties.searchLinkToAdvancedDataProviders);
}else if(this.selectedEntity == "organization"){
url = (simpleView?this.properties.searchLinkToOrganizations:this.properties.searchLinkToAdvancedOrganizations);
}
return url;
}
}

View File

@ -0,0 +1,22 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {EntitiesSelectionComponent} from "./entitiesSelection.component";
import {ConfigurationServiceModule} from "../../utils/configuration/configurationService.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, ReactiveFormsModule, ConfigurationServiceModule
],
declarations: [
EntitiesSelectionComponent,
],
providers: [],
exports: [
EntitiesSelectionComponent
]
})
export class EntitiesSelectionModule {
}

View File

@ -80,6 +80,7 @@ export class NewSearchPageComponent {
url = null;
@Input() entitiesSelection:boolean = true;
constructor(private route: ActivatedRoute,
private location: Location,
private _meta: Meta,
@ -590,6 +591,8 @@ export class NewSearchPageComponent {
for (let type of URLparams["type"].split(",")) {
allFqs += "&type=" + type;
}
}else{
allFqs += "&type=publications&type=datasets&type=software&type=other";
}
} else if (this.entityType == "publication") {
allFqs += "&type=publications";
@ -849,13 +852,14 @@ export class NewSearchPageComponent {
* @param customFilter
* @param params
*/
prepareSearchPage(fieldIds, selectedFields, refineFields, fieldIdsMap, customFilter, params, entityType) {
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);
}

View File

@ -1,23 +1,28 @@
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {FormBuilder, FormGroup} from "@angular/forms";
import {Filter} from "./searchHelperClasses.class";
import {EnvProperties} from "../../utils/properties/env-properties";
import {ConfigurationService} from "../../utils/configuration/configuration.service";
@Component({
selector: 'quick-selections',
template: `
<form *ngIf="resultTypes" [formGroup]="control">
<div>
<mat-slide-toggle *ngIf="quickFilter"
class="example-margin" formControlName="QFselected" (change)="quickFilterChanged()">
{{quickFilter.value}}
<form *ngIf="resultTypes || quickFilter" [formGroup]="control" class="uk-text-small uk-margin-small-bottom">
<div *ngIf="quickFilter" class="uk-margin-small-top uk-margin-small-left">
<span class="uk-text-bold">{{quickFilter.value}}</span>
<mat-slide-toggle
class="uk-margin-small-left" formControlName="QFselected" (change)="quickFilterChanged()">
</mat-slide-toggle>
</div>
<span *ngIf="resultTypes">
<span> <input type="checkbox" id="publ" name="Publications" formControlName="publication" (change)="changed()">Publications </span>
<span> <input type="checkbox" formControlName="dataset" (change)="changed()"> Research Data </span>
<span> <input type="checkbox" formControlName="software" (change)="changed()"> Software </span>
<span> <input type="checkbox" formControlName="other" (change)="changed()"> Other Research outcomes </span>
<div *ngIf="resultTypes && showEntities" class="uk-margin-small-top uk-margin-small-left">
<span class="uk-text-muted">Include: </span>
<span>
<span *ngIf="showPublications" class="uk-margin-small-left"> <input type="checkbox" id="publ" name="Publications" formControlName="publication" (change)="changed()"> Publications </span>
<span *ngIf="showDatasets" class="uk-margin-small-left"> <input type="checkbox" formControlName="dataset" (change)="changed()"> Research Data </span>
<span *ngIf="showSoftware" class="uk-margin-small-left"> <input type="checkbox" formControlName="software" (change)="changed()"> Software </span>
<span *ngIf="showOrp" class="uk-margin-small-left"> <input type="checkbox" formControlName="other" (change)="changed()"> Other Research outcomes </span>
</span>
</div>
</form>
`
})
@ -30,8 +35,13 @@ export class QuickSelectionsComponent implements OnChanges {
@Input() QFselected: boolean;
control: FormGroup;
initialized = false;
constructor(private _fb: FormBuilder) {
@Input() properties: EnvProperties;
showPublications:boolean= false;
showDatasets:boolean= false;
showSoftware: boolean = false;
showOrp: boolean = false;
showEntities = false;
constructor(private _fb: FormBuilder, private config: ConfigurationService) {
this.control = this._fb.group({
publication: true,
@ -41,6 +51,7 @@ export class QuickSelectionsComponent implements OnChanges {
QFselected: true
});
}
changed(typeChanged: boolean = true) {
@ -67,16 +78,18 @@ export class QuickSelectionsComponent implements OnChanges {
quickFilterChanged() {
let value = this.control.getRawValue();
this.quickFilter.selected = value.QFselected;
if (value.QFselected) {
for (let filterValue of this.quickFilter.filter.values) {
filterValue.selected = (filterValue.name == this.quickFilter.value)
if(this.quickFilter.filter) {
if (value.QFselected) {
for (let filterValue of this.quickFilter.filter.values) {
filterValue.selected = (filterValue.name == this.quickFilter.value)
}
this.quickFilter.filter.countSelectedValues = 1;
} else {
for (let filterValue of this.quickFilter.filter.values) {
filterValue.selected = false;
}
this.quickFilter.filter.countSelectedValues = 0;
}
this.quickFilter.filter.countSelectedValues = 1;
} else {
for (let filterValue of this.quickFilter.filter.values) {
filterValue.selected = false;
}
this.quickFilter.filter.countSelectedValues = 0;
}
this.typeChange.emit({});
}
@ -85,6 +98,19 @@ export class QuickSelectionsComponent implements OnChanges {
if (this.resultTypes) {
this.setFormValues();
}
if(this.properties) {
this.config.getCommunityInformation(this.properties, this.properties.adminToolsCommunity).subscribe(data => {
var showEntity = {};
for (var i = 0; i < data['entities'].length; i++) {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
this.showPublications = showEntity["publication"];
this.showDatasets = showEntity["dataset"];
this.showSoftware = showEntity["software"];
this.showOrp = showEntity["orp"];
this.showEntities = this.showPublications || this.showDatasets || this.showSoftware || this.showOrp;
});
}
}
ngOnChanges(changes: SimpleChanges): void {

View File

@ -2,14 +2,14 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {QuickSelectionsComponent} from "./quick-selections.component";
import {MatCheckboxModule, MatSlideToggleModule} from "@angular/material";
import {ConfigurationServiceModule} from "../../utils/configuration/configurationService.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, ShowAuthorsModule, MatCheckboxModule, ReactiveFormsModule, MatSlideToggleModule
RouterModule, MatCheckboxModule, ReactiveFormsModule, MatSlideToggleModule, ConfigurationServiceModule
],
declarations: [
QuickSelectionsComponent,

View File

@ -3,10 +3,10 @@ import {RouterHelper} from '../../utils/routerHelper.class';
import {Router} from '@angular/router';
@Component({
selector: 'search-form',
template: `
selector: 'search-form',
template: `
<form [class]="((isDisabled)?'uk-disabled':'')+' uk-margin uk-margin-top '+(setFormCentered?' uk-text-center':'')">
<form [class]="((isDisabled)?'uk-disabled':'')+(setFormCentered?' uk-text-center':'')">
<input type="text" class="uk-input uk-width-xlarge@l uk-width-medium@m uk-width-auto" [placeholder]="placeholderText" aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
<button *ngIf="!link" (click)="keywordChanged()" type="submit" class=" uk-button portal-button uk-margin-small-left">
<span class="uk-icon" ><svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1.5"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg></span>

View File

@ -35,14 +35,11 @@ export class SearchDataprovidersService {
}
//((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
let url = properties.searchResourcesAPIURL;
var basicQuery = "(oaftype exact datasource) " +
'and (datasourcecompatibilityid <> "UNKNOWN")';
url += "?query=";
let url = properties.searchAPIURLLAst+"resources2/?format=json&type=datasources";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
url +="&query=(" + params + ")";
}
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
@ -50,7 +47,7 @@ export class SearchDataprovidersService {
if(refineQuery) {
url += "&" + refineQuery;
}
url += "&page="+(page-1)+"&size="+size+"&format=json";
url += "&page="+(page-1)+"&size="+size;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())

View File

@ -57,13 +57,12 @@ export class SearchOrganizationsService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));
}
advancedSearchOrganizations (params: string, page: number, size: number, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
let url = properties.searchResourcesAPIURL;
var basicQuery = "oaftype exact organization and "
+"(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " +
let url = properties.searchAPIURLLAst+"resources2/?format=json&type=organizations";
var basicQuery = "(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " +
"reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or " +
"reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)";
url += "?query=";
url += "&query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
@ -76,7 +75,6 @@ export class SearchOrganizationsService {
url += "&" + refineQuery;
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())

View File

@ -52,14 +52,15 @@ export class SearchProjectsService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
advancedSearchProjects (params: string, page: number, size: number, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
let url = properties.searchResourcesAPIURL;
var basicQuery = "(oaftype exact project) "
url += "?query=";
let url = properties.searchAPIURLLAst+"resources2/?format=json&type=projects";
// var basicQuery = "(oaftype exact project) "
// url += "?query=";
if(params!= null && params != '' ) {
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")";
}else{
url +=" ( "+basicQuery+ " ) ";
url +="&query=(" + params + ")";
}
// else{
// url +=" ( "+basicQuery+ " ) ";
// }
if(refineParams!= null && refineParams != '' ) {
url += refineParams;
}
@ -67,7 +68,7 @@ export class SearchProjectsService {
url += "&" + refineQuery;
}
url += "&page="+(page-1)+"&size="+size;
url += "&format=json";
// url += "&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]));

View File

@ -106,7 +106,7 @@ export class SearchResearchResultsService {
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "publication")]));
}
advancedSearchResults (resultType:string, params: string, page: number, size: number, sortBy: string, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null ):any {
let url = properties.searchAPIURLLAst+"results/?format=json";
let url = properties.searchAPIURLLAst+"resources2/?format=json";
if(params!= null && params != '' ) {
url +="&query=(" + params + ")";
}