Merge branch 'develop' of code-repo.d4science.org:MaDgIK/openaire-library into develop
This commit is contained in:
commit
2b2aaed2b8
|
@ -516,7 +516,7 @@
|
|||
</div>
|
||||
</span>
|
||||
</li>
|
||||
<li class="uk-margin-small-top">
|
||||
<li *ngIf="!indicator.defaultId" class="uk-margin-small-top">
|
||||
<a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()"
|
||||
class="uk-flex uk-flex-middle">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue