diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html
index 21d0f0e2..d6f47d83 100644
--- a/monitor-admin/topic/indicators.component.html
+++ b/monitor-admin/topic/indicators.component.html
@@ -516,7 +516,7 @@
-
+
diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts
index 876f7dc2..5a295226 100644
--- a/searchPages/searchDataProviders.component.ts
+++ b/searchPages/searchDataProviders.component.ts
@@ -13,6 +13,7 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
import {properties} from "../../../environments/environment";
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
+import {zip} from "rxjs";
@Component({
@@ -207,12 +208,28 @@ export class SearchDataProvidersComponent {
parametersFull = parameters;
refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix;
}
- this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( parametersFull, page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineQueryFull, isDeposit, true)
- //.switchMap(
- .subscribe(
+
+ let filterQueries;
+ let filterIds = [];
+ let fields = this.searchPage.getFields();
+ for(let filter of this.searchPage.URLCreatedFilters) {
+ filterIds.push(filter.filterId);
+ fields = fields.filter(field => field != filter.filterId);
+ }
+
+ if(filterIds.length > 0) {
+ filterQueries = zip(this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineQueryFull, isDeposit, false),
+ this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineQueryFull, isDeposit, true)
+ );
+ } else {
+ filterQueries = this._searchDataProvidersService.advancedSearchDataproviders(parametersFull, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineQueryFull, isDeposit, true)
+ }
+
+ this.searchFiltersSub = filterQueries.subscribe(
data => {
- let totalResults = data[0];
- let filters = data[2];
+ let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
+ let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
+
this.filtersReturned(refine, filters, totalResults, page);
},
err => {
diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts
index 45c49dcc..676dde0b 100644
--- a/searchPages/searchOrganizations.component.ts
+++ b/searchPages/searchOrganizations.component.ts
@@ -10,6 +10,7 @@ import {EnvProperties} from '../utils/properties/env-properties';
import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.component";
import {properties} from "../../../environments/environment";
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
+import {zip} from "rxjs";
@Component({
@@ -169,12 +170,28 @@ export class SearchOrganizationsComponent {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
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, true)
- //.switchMap(
- .subscribe(
+
+ let filterQueries;
+ let filterIds = [];
+ let fields = this.searchPage.getFields();
+ for(let filter of this.searchPage.URLCreatedFilters) {
+ filterIds.push(filter.filterId);
+ fields = fields.filter(field => field != filter.filterId);
+ }
+
+ if(filterIds.length > 0) {
+ filterQueries = zip(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
+ this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
+ );
+ } else {
+ filterQueries = this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
+ }
+
+ this.searchFiltersSub = filterQueries.subscribe(
data => {
- let totalResults = data[0];
- let filters = data[2];
+ let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
+ let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
+
this.filtersReturned(refine, filters, totalResults, page);
},
err => {
diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts
index bb76455c..0f9bb5ad 100644
--- a/searchPages/searchProjects.component.ts
+++ b/searchPages/searchProjects.component.ts
@@ -11,6 +11,7 @@ import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.co
import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
import {properties} from "../../../environments/environment";
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
+import {zip} from "rxjs";
@Component({
selector: 'search-projects',
@@ -174,30 +175,45 @@ export class SearchProjectsComponent {
disableRefineForms: this.disableRefineForms,
searchUtils: this.searchUtils
});
- this.searchFiltersSub = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
- //.switchMap(
- .subscribe(
- data => {
- let totalResults = data[0];
- let filters = data[2];
- this.filtersReturned(refine, filters, totalResults, page);
-
- },
- err => {
- this.filters = this.searchPage.prepareFiltersToShow([], 0);
- this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
-
- this.handleError("Error getting refine filters for projects: ", err);
- this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
-
- this.disableRefineForms = false;
- this.searchPageUpdates.emit({
- disableForms: this.disableForms,
- disableRefineForms: this.disableRefineForms,
- searchUtils: this.searchUtils
- })
- }
+
+ let filterQueries;
+ let filterIds = [];
+ let fields = this.searchPage.getFields();
+ for(let filter of this.searchPage.URLCreatedFilters) {
+ filterIds.push(filter.filterId);
+ fields = fields.filter(field => field != filter.filterId);
+ }
+
+ if(filterIds.length > 0) {
+ filterQueries = zip(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
+ this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
);
+ } else {
+ filterQueries = this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
+ }
+
+ this.searchFiltersSub = filterQueries.subscribe(
+ data => {
+ let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
+ let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
+
+ this.filtersReturned(refine, filters, totalResults, page);
+ },
+ err => {
+ this.filters = this.searchPage.prepareFiltersToShow([], 0);
+ this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
+
+ this.handleError("Error getting refine filters for projects: ", err);
+ this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status);
+
+ this.disableRefineForms = false;
+ this.searchPageUpdates.emit({
+ disableForms: this.disableForms,
+ disableRefineForms: this.disableRefineForms,
+ searchUtils: this.searchUtils
+ })
+ }
+ );
}
}
diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts
index 176ae26c..33ea7fcc 100644
--- a/searchPages/searchResearchResults.component.ts
+++ b/searchPages/searchResearchResults.component.ts
@@ -14,6 +14,7 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
import {StringUtils} from "../utils/string-utils.class";
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
+import {zip} from "rxjs";
@Component({
selector: 'search-research-results',
@@ -253,13 +254,27 @@ export class SearchResearchResultsComponent {
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.disableRefineForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
- this.searchFiltersSub = this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, true)
- // this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery)
- //.switchMap(
- .subscribe(
+
+ let filterQueries;
+ let filterIds = [];
+ let fields = this.searchPage.getFields();
+ for(let filter of this.searchPage.URLCreatedFilters) {
+ filterIds.push(filter.filterId);
+ fields = fields.filter(field => field != filter.filterId);
+ }
+
+ if(filterIds.length > 0) {
+ filterQueries = zip(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
+ this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
+ );
+ } else {
+ filterQueries = this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true);
+ }
+
+ this.searchFiltersSub = filterQueries.subscribe(
data => {
- let totalResults = data[0];
- let filters = data[2];
+ let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
+ let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
// if (refine) {
// this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults);
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts
index e8447acb..58899ada 100644
--- a/searchPages/searchUtils/newSearchPage.component.ts
+++ b/searchPages/searchUtils/newSearchPage.component.ts
@@ -551,9 +551,11 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
/*
* Get a query string of all fields, that want to get from search (e.g. &fields=funderid&fields=projectstartyear&...))
*/
- public getRefineFieldsQuery(): string {
-
- var fields: string[] = this.getFields();
+ public getRefineFieldsQuery(fields: string[] = null): string {
+
+ if(!fields) {
+ fields = this.getFields();
+ }
var fieldsStr = ""
for (var i = 0; i < fields.length; i++) {
fieldsStr += "&fields=" + fields[i];
@@ -1816,10 +1818,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
this.showUnknownFilters = true;
this.filters = filters;
}
-
+
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, this.URLCreatedStaticFilters, true);
//this.checkSelectedRangeFilters(this.rangeFilters);
-
+
this.checkSelectedFilters(this.filters);
this.countSelectedFilters(this.filters);
this.updateMeta(this.pageTitle);