Production release December 2023 #27
|
@ -1,4 +1,4 @@
|
||||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
import {ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
||||||
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
|
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
|
||||||
|
@ -42,7 +42,8 @@ import {RefineFieldResultsService} from "../services/refineFieldResults.service"
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
|
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
|
||||||
[showResultCount]="true" [showIndexInfo]="type!='deposit'"
|
[showResultCount]="true" [showIndexInfo]="type!='deposit'"
|
||||||
[tableViewLink]="tableViewLink"
|
[tableViewLink]="tableViewLink"
|
||||||
[sort]="false" [showBreadcrumb]="showBreadcrumb" [basicMetaDescription]="metaDescription">
|
[sort]="false" [showBreadcrumb]="showBreadcrumb" [basicMetaDescription]="metaDescription"
|
||||||
|
(filterRequestAll)="filterRequestedAll($event)">
|
||||||
|
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
|
|
||||||
|
@ -166,6 +167,8 @@ export class SearchDataProvidersComponent {
|
||||||
}
|
}
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(params), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(params), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
|
||||||
|
this.refineQuery = this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -187,7 +190,7 @@ export class SearchDataProvidersComponent {
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||||
|
|
||||||
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
|
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
|
||||||
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"))
|
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"), true)
|
||||||
//.switchMap(
|
//.switchMap(
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -333,4 +336,41 @@ export class SearchDataProvidersComponent {
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error(OpenaireEntities.DATASOURCES+" advanced Search Page: "+message, error);
|
console.error(OpenaireEntities.DATASOURCES+" advanced Search Page: "+message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public filterRequestedAll(oldFilter: Filter) {
|
||||||
|
let fieldsStr: string = "&fields=" + oldFilter.filterId+"&refine=true";
|
||||||
|
|
||||||
|
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), 1, 0, properties, fieldsStr, [oldFilter.filterId], this.refineQuery).subscribe(
|
||||||
|
// this.searchFiltersSub = this._refineFieldsResultsService.getAllRefineFieldResultsByFieldName(oldFilter.filterId, this.entityType, this.properties, this.refineQuery).subscribe(
|
||||||
|
res => {
|
||||||
|
let filter: Filter = res[1][0];
|
||||||
|
if(filter.values.length == 0) {
|
||||||
|
filter = oldFilter;
|
||||||
|
filter.countAllValues = 0;
|
||||||
|
} else {
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
|
// console.log(filter);
|
||||||
|
for (let value of filter.values) {
|
||||||
|
for (let oldValue of oldFilter.values) {
|
||||||
|
if (oldValue.id == value.id && oldValue.selected) {
|
||||||
|
value.selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == filter.filterId);
|
||||||
|
filter.isOpen = true;
|
||||||
|
this.filters[index] = filter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == oldFilter.filterId);
|
||||||
|
oldFilter.countAllValues = 0;
|
||||||
|
this.filters[index] = oldFilter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
import {ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
||||||
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
import {SearchOrganizationsService} from '../services/searchOrganizations.service';
|
||||||
|
@ -9,6 +9,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -36,7 +37,7 @@ import {properties} from "../../../environments/environment";
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
[simpleView]="simpleView" formPlaceholderText="Search by organization name..."
|
||||||
[showSwitchSearchLink]="showSwitchSearchLink"
|
[showSwitchSearchLink]="showSwitchSearchLink"
|
||||||
[showBreadcrumb]="showBreadcrumb"
|
[showBreadcrumb]="showBreadcrumb"
|
||||||
>
|
(filterRequestAll)="filterRequestedAll($event)">
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
@ -79,7 +80,11 @@ export class SearchOrganizationsComponent {
|
||||||
searchResultsSub: any;
|
searchResultsSub: any;
|
||||||
searchFiltersSub: any;
|
searchFiltersSub: any;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) {
|
private refineQuery: string = "";
|
||||||
|
|
||||||
|
constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService,
|
||||||
|
private _refineFieldsResultsService: RefineFieldResultsService,
|
||||||
|
private cdr: ChangeDetectorRef) {
|
||||||
this.results =[];
|
this.results =[];
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.errorMessages = new ErrorMessagesComponent();
|
this.errorMessages = new ErrorMessagesComponent();
|
||||||
|
@ -135,6 +140,8 @@ export class SearchOrganizationsComponent {
|
||||||
}
|
}
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
|
||||||
|
this.refineQuery = this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -154,7 +161,7 @@ export class SearchOrganizationsComponent {
|
||||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||||
this.disableRefineForms = true;
|
this.disableRefineForms = true;
|
||||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||||
this.searchFiltersSub = this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
this.searchFiltersSub = this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
|
||||||
//.switchMap(
|
//.switchMap(
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -308,4 +315,41 @@ export class SearchOrganizationsComponent {
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error("Organizations advanced Search Page: "+message, error);
|
console.error("Organizations advanced Search Page: "+message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public filterRequestedAll(oldFilter: Filter) {
|
||||||
|
let fieldsStr: string = "&fields=" + oldFilter.filterId+"&refine=true";
|
||||||
|
|
||||||
|
this.searchFiltersSub = this._searchOrganizationsService.advancedSearchOrganizations(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), 1, 0, properties, fieldsStr, [oldFilter.filterId], this.refineQuery).subscribe(
|
||||||
|
// this.searchFiltersSub = this._refineFieldsResultsService.getAllRefineFieldResultsByFieldName(oldFilter.filterId, "organization", this.properties, this.refineQuery).subscribe(
|
||||||
|
res => {
|
||||||
|
let filter: Filter = res[1][0];
|
||||||
|
if(filter.values.length == 0) {
|
||||||
|
filter = oldFilter;
|
||||||
|
filter.countAllValues = 0;
|
||||||
|
} else {
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
|
// console.log(filter);
|
||||||
|
for (let value of filter.values) {
|
||||||
|
for (let oldValue of oldFilter.values) {
|
||||||
|
if (oldValue.id == value.id && oldValue.selected) {
|
||||||
|
value.selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == filter.filterId);
|
||||||
|
filter.isOpen = true;
|
||||||
|
this.filters[index] = filter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == oldFilter.filterId);
|
||||||
|
oldFilter.countAllValues = 0;
|
||||||
|
this.filters[index] = oldFilter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
import {ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
||||||
import {SearchProjectsService} from '../services/searchProjects.service';
|
import {SearchProjectsService} from '../services/searchProjects.service';
|
||||||
|
@ -10,6 +10,7 @@ import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
|
||||||
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-projects',
|
selector: 'search-projects',
|
||||||
|
@ -36,7 +37,7 @@ import {properties} from "../../../environments/environment";
|
||||||
[simpleView]="simpleView" formPlaceholderText="Search by title, acronym, project code..."
|
[simpleView]="simpleView" formPlaceholderText="Search by title, acronym, project code..."
|
||||||
[showSwitchSearchLink]="showSwitchSearchLink"
|
[showSwitchSearchLink]="showSwitchSearchLink"
|
||||||
[sort]="false" [showBreadcrumb]="showBreadcrumb"
|
[sort]="false" [showBreadcrumb]="showBreadcrumb"
|
||||||
>
|
(filterRequestAll)="filterRequestedAll($event)">
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -82,8 +83,12 @@ export class SearchProjectsComponent {
|
||||||
subs: any[] = [];
|
subs: any[] = [];
|
||||||
searchResultsSub: any;
|
searchResultsSub: any;
|
||||||
searchFiltersSub: any;
|
searchFiltersSub: any;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService) {
|
private refineQuery: string = "";
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService,
|
||||||
|
private _refineFieldsResultsService: RefineFieldResultsService,
|
||||||
|
private cdr: ChangeDetectorRef) {
|
||||||
this.results = [];
|
this.results = [];
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.errorMessages = new ErrorMessagesComponent();
|
this.errorMessages = new ErrorMessagesComponent();
|
||||||
|
@ -136,6 +141,8 @@ export class SearchProjectsComponent {
|
||||||
}
|
}
|
||||||
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
|
||||||
|
this.refineQuery = this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +167,7 @@ export class SearchProjectsComponent {
|
||||||
disableRefineForms: this.disableRefineForms,
|
disableRefineForms: this.disableRefineForms,
|
||||||
searchUtils: this.searchUtils
|
searchUtils: this.searchUtils
|
||||||
});
|
});
|
||||||
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
|
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
|
||||||
//.switchMap(
|
//.switchMap(
|
||||||
.subscribe(
|
.subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -337,4 +344,41 @@ export class SearchProjectsComponent {
|
||||||
private handleError(message: string, error) {
|
private handleError(message: string, error) {
|
||||||
console.error("Projects advanced Search Page: " + message, error);
|
console.error("Projects advanced Search Page: " + message, error);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public filterRequestedAll(oldFilter: Filter) {
|
||||||
|
let fieldsStr: string = "&fields=" + oldFilter.filterId+"&refine=true";
|
||||||
|
|
||||||
|
this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), 1, 0, properties, fieldsStr, [oldFilter.filterId], this.refineQuery).subscribe(
|
||||||
|
// this.searchFiltersSub = this._refineFieldsResultsService.getAllRefineFieldResultsByFieldName(oldFilter.filterId, "project", this.properties, this.refineQuery).subscribe(
|
||||||
|
res => {
|
||||||
|
let filter: Filter = res[1][0];
|
||||||
|
if(filter.values.length == 0) {
|
||||||
|
filter = oldFilter;
|
||||||
|
filter.countAllValues = 0;
|
||||||
|
} else {
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
|
// console.log(filter);
|
||||||
|
for (let value of filter.values) {
|
||||||
|
for (let oldValue of oldFilter.values) {
|
||||||
|
if (oldValue.id == value.id && oldValue.selected) {
|
||||||
|
value.selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == filter.filterId);
|
||||||
|
filter.isOpen = true;
|
||||||
|
this.filters[index] = filter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == oldFilter.filterId);
|
||||||
|
oldFilter.countAllValues = 0;
|
||||||
|
this.filters[index] = oldFilter;
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
import {ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
import {AdvancedField, Filter} from './searchUtils/searchHelperClasses.class';
|
||||||
import {SearchResearchResultsService} from '../services/searchResearchResults.service';
|
import {SearchResearchResultsService} from '../services/searchResearchResults.service';
|
||||||
|
@ -42,6 +42,7 @@ import {RefineFieldResultsService} from "../services/refineFieldResults.service"
|
||||||
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [showBreadcrumb]="showBreadcrumb"
|
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [showBreadcrumb]="showBreadcrumb"
|
||||||
[showSwitchSearchLink]="showSwitchSearchLink"
|
[showSwitchSearchLink]="showSwitchSearchLink"
|
||||||
[stickyForm]="stickyForm"
|
[stickyForm]="stickyForm"
|
||||||
|
(filterRequestAll)="filterRequestedAll($event)"
|
||||||
>
|
>
|
||||||
</new-search-page>
|
</new-search-page>
|
||||||
`
|
`
|
||||||
|
@ -188,6 +189,8 @@ export class SearchResearchResultsComponent {
|
||||||
}
|
}
|
||||||
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params) + this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
|
||||||
|
this.refineQuery = this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,4 +499,62 @@ export class SearchResearchResultsComponent {
|
||||||
public getEntityFileName(entityType: string) {
|
public getEntityFileName(entityType: string) {
|
||||||
return StringUtils.getEntityFileName(entityType);
|
return StringUtils.getEntityFileName(entityType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public filterRequestedAll(oldFilter: Filter) {
|
||||||
|
let fieldsStr: string = "&fields=" + oldFilter.filterId+"&refine=true";
|
||||||
|
|
||||||
|
this.searchFiltersSub = this._searchResearchResultsService.advancedSearchResults(this.resultType, this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), 1, 0, null, properties, fieldsStr, [oldFilter.filterId], this.refineQuery).subscribe(
|
||||||
|
// this.searchFiltersSub = this._refineFieldsResultsService.getAllRefineFieldResultsByFieldName(oldFilter.filterId, this.resultType, this.properties, this.refineQuery).subscribe(
|
||||||
|
res => {
|
||||||
|
// let filter: Filter = res[1][0];
|
||||||
|
let filter: Filter = res[2][0];
|
||||||
|
if(filter.values.length == 0) {
|
||||||
|
filter = oldFilter;
|
||||||
|
filter.countAllValues = 0;
|
||||||
|
} else {
|
||||||
|
filter.countAllValues = filter.values.length;
|
||||||
|
for (let value of filter.values) {
|
||||||
|
for (let oldValue of oldFilter.values) {
|
||||||
|
if (oldValue.id == value.id && oldValue.selected) {
|
||||||
|
value.selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == filter.filterId);
|
||||||
|
filter.isOpen = true;
|
||||||
|
filter.countSelectedValues = oldFilter.countSelectedValues;
|
||||||
|
filter.radioValue = oldFilter.radioValue;
|
||||||
|
this.filters[index] = filter;
|
||||||
|
// this.updateOrderedFilter(filter);
|
||||||
|
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
let index: number = this.filters.findIndex((fltr: Filter) => fltr.filterId == oldFilter.filterId);
|
||||||
|
oldFilter.countAllValues = 0;
|
||||||
|
this.filters[index] = oldFilter;
|
||||||
|
// this.updateOrderedFilter(oldFilter);
|
||||||
|
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// public updateOrderedFilter(filter: Filter) {
|
||||||
|
// if(this.orderedFilters) {
|
||||||
|
// let groupIndex = 0;
|
||||||
|
// let index;
|
||||||
|
// for(let group of this.orderedFilters) {
|
||||||
|
// index = group.values.findIndex((fltr: Filter) => fltr.filterId == filter.filterId);
|
||||||
|
// if(index != -1) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// groupIndex++;
|
||||||
|
// }
|
||||||
|
// this.orderedFilters[groupIndex].values[index] = filter;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
[isDisabled]="disabled"
|
[isDisabled]="disabled"
|
||||||
[filter]="filter" [showResultCount]=showResultCount
|
[filter]="filter" [showResultCount]=showResultCount
|
||||||
(onFilterChange)="filterChanged($event)"
|
(onFilterChange)="filterChanged($event)"
|
||||||
|
(onFilterToggle)="filterToggled($event)"
|
||||||
[actionRoute]="true"></search-filter>
|
[actionRoute]="true"></search-filter>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {
|
import {
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ElementRef, Inject,
|
ElementRef, EventEmitter, Inject,
|
||||||
Input,
|
Input,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit, PLATFORM_ID,
|
OnInit, Output, PLATFORM_ID,
|
||||||
SimpleChanges,
|
SimpleChanges,
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
@ -157,6 +157,8 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
isServer: boolean;
|
isServer: boolean;
|
||||||
searchTerm: string = null;
|
searchTerm: string = null;
|
||||||
advancedSearchTerms: number = 0;
|
advancedSearchTerms: number = 0;
|
||||||
|
|
||||||
|
@Output() filterRequestAll = new EventEmitter();
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
|
@ -454,7 +456,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
var fields: string[] = [];
|
var fields: string[] = [];
|
||||||
for (var i = 0; i < this.refineFields.length; i++) {
|
for (var i = 0; i < this.refineFields.length; i++) {
|
||||||
var dependentTo = this.searchFieldsHelper.DEPENDENT_FIELDS[this.refineFields[i]];
|
var dependentTo = this.searchFieldsHelper.DEPENDENT_FIELDS[this.refineFields[i]];
|
||||||
|
// TODO check again the checks
|
||||||
//if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected
|
//if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected
|
||||||
if (this.searchFieldsHelper.HIDDEN_FIELDS.indexOf(this.refineFields[i]) == -1
|
if (this.searchFieldsHelper.HIDDEN_FIELDS.indexOf(this.refineFields[i]) == -1
|
||||||
|| (selected_filters.indexOf(dependentTo) != -1) || (selected_filters.indexOf(this.refineFields[i]) != -1)
|
|| (selected_filters.indexOf(dependentTo) != -1) || (selected_filters.indexOf(this.refineFields[i]) != -1)
|
||||||
|
@ -773,6 +775,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
this.goTo(1);
|
this.goTo(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterToggled($event) {
|
||||||
|
this.filterRequestAll.emit($event)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if there is a change in the values of the quick filter, this function has to be run, to also update the quickFilter
|
* if there is a change in the values of the quick filter, this function has to be run, to also update the quickFilter
|
||||||
|
|
|
@ -10,33 +10,41 @@
|
||||||
<ng-container *ngTemplateOutlet="input_label_wrapper; context: {filter: filter, value: value}"></ng-container>
|
<ng-container *ngTemplateOutlet="input_label_wrapper; context: {filter: filter, value: value}"></ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="addShowMore && (filter.values.length) > filterValuesNum">
|
<div *ngIf="addShowMore && hasMoreValues">
|
||||||
<a *ngIf="filterValuesNum > 0 " class="uk-text-small view-more-less-link uk-margin-small-top" [ngClass]="((isDisabled)?'uk-disabled uk-link-muted ':'')" (click)="toggle($event)">
|
<a *ngIf="filterValuesNum > 0 " class="uk-text-small view-more-less-link uk-margin-small-top" [ngClass]="((isDisabled)?'uk-disabled uk-link-muted ':'')" (click)="toggle($event)">
|
||||||
<span *ngIf="!isOpen">View all</span>
|
<span *ngIf="!filter.isOpen">View all</span>
|
||||||
<span *ngIf="isOpen">View less </span>
|
<span *ngIf="filter.isOpen">View less </span>
|
||||||
</a>
|
</a>
|
||||||
<div *ngIf="isOpen" class="uk-text-small uk-margin-small-top uk-margin-small-bottom">
|
<div *ngIf="filter.isOpen" class="uk-text-small uk-margin-small-top uk-margin-small-bottom">
|
||||||
<div class="uk-margin-small-left">
|
<div *ngIf="filter.countAllValues == -1">
|
||||||
<div class="uk-text-meta">Top 100 values are shown in the filters</div>
|
<loading class="uk-height-small uk-display-block" size="medium"></loading>
|
||||||
<div class="uk-flex uk-flex-bottom uk-margin-top">
|
</div>
|
||||||
<div input class="uk-width-1-2@m uk-margin-right" [placeholder]="{label: 'Search', static: true}" inputClass="inner small" [(value)]="keyword" (valueChange)="initMatching()"></div>
|
<div *ngIf="filter.countAllValues == 0">
|
||||||
<div *ngIf="showResultCount === true" input type="select" class="uk-width-expand" placeholder="Sort by"
|
<span class="uk-text-warning">An error occured. </span><span><a class="uk-button-link" (click)="toggleWithoutUpdate()">Please try again</a>.</span>
|
||||||
inputClass="border-bottom" [(value)]="sortBy" [options]="sortByOptions" (valueChange)="sort()"></div>
|
</div>
|
||||||
|
<ng-container *ngIf="(!filter.countAllValues && filter.countAllValues != 0) || filter.countAllValues > 0">
|
||||||
|
<div class="uk-margin-small-left">
|
||||||
|
<div class="uk-text-meta">Top 100 values are shown in the filters</div>
|
||||||
|
<div class="uk-flex uk-flex-bottom uk-margin-top">
|
||||||
|
<div input class="uk-width-1-2@m uk-margin-right" [placeholder]="{label: 'Search', static: true}" inputClass="inner small" [(value)]="keyword" (valueChange)="initMatching()"></div>
|
||||||
|
<div *ngIf="showResultCount === true" input type="select" class="uk-width-expand" placeholder="Sort by"
|
||||||
|
inputClass="border-bottom" [(value)]="sortBy" [options]="sortByOptions" (valueChange)="sort()"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="uk-overflow-auto uk-height-max-small uk-margin-small-left uk-margin-small-right uk-margin-top">
|
||||||
<div class="uk-overflow-auto uk-height-max-small uk-margin-small-left uk-margin-small-right uk-margin-top">
|
<ng-container *ngFor="let value of this.sortedValues">
|
||||||
<ng-container *ngFor="let value of this.sortedValues">
|
<div *ngIf="filterKeywords(value.name)" title="{{value.name}}"
|
||||||
<div *ngIf="filterKeywords(value.name)" title="{{value.name}}"
|
class="uk-animation-fade uk-text-small">
|
||||||
class="uk-animation-fade uk-text-small">
|
<ng-container *ngTemplateOutlet="input_label_wrapper; context: {filter: filter, value: value}"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="input_label_wrapper; context: {filter: filter, value: value}"></ng-container>
|
</div>
|
||||||
</div>
|
</ng-container>
|
||||||
</ng-container>
|
<ng-container *ngIf="!hasMatch">
|
||||||
<ng-container *ngIf="!hasMatch">
|
<div class="uk-padding-small uk-text-meta">
|
||||||
<div class="uk-padding-small uk-text-meta">
|
No filters available with that term
|
||||||
No filters available with that term
|
</div>
|
||||||
</div>
|
</ng-container>
|
||||||
</ng-container>
|
</div>
|
||||||
</div>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,6 +26,7 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
@Input() addShowMore: boolean = true;
|
@Input() addShowMore: boolean = true;
|
||||||
@Input() showMoreInline: boolean = true;
|
@Input() showMoreInline: boolean = true;
|
||||||
@Input() filterValuesNum: number = 6;
|
@Input() filterValuesNum: number = 6;
|
||||||
|
public hasMoreValues: boolean = false;
|
||||||
public showAll: boolean = false;
|
public showAll: boolean = false;
|
||||||
public _maxCharacters: number = 28;
|
public _maxCharacters: number = 28;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@Output() modalChange = new EventEmitter();
|
@Output() modalChange = new EventEmitter();
|
||||||
@Output() onFilterChange = new EventEmitter();
|
@Output() onFilterChange = new EventEmitter();
|
||||||
|
@Output() onFilterToggle = new EventEmitter();
|
||||||
keyword = "";
|
keyword = "";
|
||||||
sortBy: "name" | "num" = "name";
|
sortBy: "name" | "num" = "name";
|
||||||
sortByOptions: Option[] = [{label: 'Results number', value: 'num'}, {label: 'Name', value: 'name'}];
|
sortByOptions: Option[] = [{label: 'Results number', value: 'num'}, {label: 'Name', value: 'name'}];
|
||||||
|
@ -41,7 +43,7 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
@Input() actionRoute: boolean = false;
|
@Input() actionRoute: boolean = false;
|
||||||
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
|
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
|
||||||
sub;
|
sub;
|
||||||
public isOpen: boolean = false;
|
@Input() isOpen: boolean = false;
|
||||||
sortedValues;
|
sortedValues;
|
||||||
hasMatch: boolean = false;
|
hasMatch: boolean = false;
|
||||||
|
|
||||||
|
@ -58,11 +60,12 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if(this.filterValuesNum == 0){
|
if(this.filterValuesNum == 0){
|
||||||
this.isOpen = true;
|
this.filter.isOpen = true;
|
||||||
this.sortBy = "num";
|
this.sortBy = "num";
|
||||||
}else{
|
|
||||||
this.isOpen = false;
|
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// this.filter.isOpen = false;
|
||||||
|
// }
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.queryParams = Object.assign({}, params);
|
this.queryParams = Object.assign({}, params);
|
||||||
this.paramPosition = SearchFields.getParameterOrder(this.filter.filterId, this.getEntries(params));
|
this.paramPosition = SearchFields.getParameterOrder(this.filter.filterId, this.getEntries(params));
|
||||||
|
@ -81,6 +84,7 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes.filter) {
|
if (changes.filter) {
|
||||||
|
this.hasMoreValues = this.filter.values.length > this.filterValuesNum;
|
||||||
// this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
// this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
||||||
this.filter.values = this.filter.values.filter(value => value && value.name != "unidentified" && value.name != "Undetermined" && !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
this.filter.values = this.filter.values.filter(value => value && value.name != "unidentified" && value.name != "Undetermined" && !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
||||||
|
|
||||||
|
@ -268,8 +272,18 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle(event) {
|
toggle(event) {
|
||||||
this.isOpen = !this.isOpen;
|
this.filter.isOpen = !this.filter.isOpen;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
this.toggleWithoutUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleWithoutUpdate() {
|
||||||
|
if(this.filter.countAllValues == 0) {
|
||||||
|
this.filter.countAllValues = -1; // if request failed, try again automatically if toggled again
|
||||||
|
}
|
||||||
|
if(this.filter.isOpen && this.filter.countAllValues < 0) {
|
||||||
|
this.onFilterToggle.emit(this.filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled(value) {
|
disabled(value) {
|
||||||
|
|
|
@ -8,11 +8,12 @@ import {ModalModule} from '../../utils/modal/modal.module';
|
||||||
import {RouterModule} from "@angular/router";
|
import {RouterModule} from "@angular/router";
|
||||||
import {InputModule} from '../../sharedComponents/input/input.module';
|
import {InputModule} from '../../sharedComponents/input/input.module';
|
||||||
import {IconsModule} from "../../utils/icons/icons.module";
|
import {IconsModule} from "../../utils/icons/icons.module";
|
||||||
|
import {LoadingModule} from "../../utils/loading/loading.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, ModalModule, RouterModule,
|
CommonModule, FormsModule, ModalModule, RouterModule,
|
||||||
InputModule, IconsModule
|
InputModule, IconsModule, LoadingModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SearchFilterComponent, SearchFilterModalComponent
|
SearchFilterComponent, SearchFilterModalComponent
|
||||||
|
|
|
@ -11,6 +11,8 @@ export class Filter{
|
||||||
public type?: string = "keyword";
|
public type?: string = "keyword";
|
||||||
public radioValue?: string = "";
|
public radioValue?: string = "";
|
||||||
// public uniqueValueIdSelected: string;
|
// public uniqueValueIdSelected: string;
|
||||||
|
public countAllValues?: number = -1; // -1: not yet requested, 0: request failed, >0 OK
|
||||||
|
public isOpen?: boolean = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Value{
|
export class Value{
|
||||||
|
|
|
@ -31,7 +31,7 @@ export class SearchDataprovidersService {
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false ):any {
|
advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false, minRef: boolean = false):any {
|
||||||
let url = properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
|
let url = properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
|
||||||
|
|
||||||
if(params!= null && params != '' ) {
|
if(params!= null && params != '' ) {
|
||||||
|
@ -45,6 +45,7 @@ export class SearchDataprovidersService {
|
||||||
url += "&" + refineQuery;
|
url += "&" + refineQuery;
|
||||||
}
|
}
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
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")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class SearchOrganizationsService {
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));
|
.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 {
|
advancedSearchOrganizations (params: string, page: number, size: number, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, minRef: boolean = false):any {
|
||||||
// &type=organizations
|
// &type=organizations
|
||||||
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
||||||
var basicQuery = "(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " +
|
var basicQuery = "(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " +
|
||||||
|
@ -76,6 +76,7 @@ export class SearchOrganizationsService {
|
||||||
url += "&" + refineQuery;
|
url += "&" + refineQuery;
|
||||||
}
|
}
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
|
|
|
@ -49,7 +49,7 @@ export class SearchProjectsService {
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
|
.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 {
|
advancedSearchProjects (params: string, page: number, size: number, properties:EnvProperties, refineParams:string=null, refineFields:string[] =null, refineQuery:string = null, minRef: boolean = false):any {
|
||||||
// &type=projects
|
// &type=projects
|
||||||
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
let url = properties.searchAPIURLLAst+"resources2/?format=json";
|
||||||
// var basicQuery = "(oaftype exact project) "
|
// var basicQuery = "(oaftype exact project) "
|
||||||
|
@ -67,6 +67,8 @@ export class SearchProjectsService {
|
||||||
url += "&" + refineQuery;
|
url += "&" + refineQuery;
|
||||||
}
|
}
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
// url += "&format=json";
|
// url += "&format=json";
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class SearchResearchResultsService {
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
.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 {
|
advancedSearchResults(resultType: string, params: string, page: number, size: number, sortBy: string, properties: EnvProperties, refineParams: string = null, refineFields: string[] = null, refineQuery: string = null, minRef: boolean = false): any {
|
||||||
let url = properties.searchAPIURLLAst + "resources2/?format=json";
|
let url = properties.searchAPIURLLAst + "resources2/?format=json";
|
||||||
if (params != null && params != '') {
|
if (params != null && params != '') {
|
||||||
url += "&query=(" + params + ")";
|
url += "&query=(" + params + ")";
|
||||||
|
@ -126,6 +126,7 @@ export class SearchResearchResultsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
url += "&page=" + (page - 1) + "&size=" + size;
|
url += "&page=" + (page - 1) + "&size=" + size;
|
||||||
|
url += minRef ? "&minRef=true" : "";
|
||||||
// url += "&format=json";
|
// url += "&format=json";
|
||||||
|
|
||||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
|
Loading…
Reference in New Issue