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>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-margin-small-top">
|
<li *ngIf="!indicator.defaultId" class="uk-margin-small-top">
|
||||||
<a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()"
|
<a (click)="activeChartIndicatorPath(chartIndicatorPaths.length); $event.preventDefault()"
|
||||||
class="uk-flex uk-flex-middle">
|
class="uk-flex uk-flex-middle">
|
||||||
<icon name="add" [flex]="true"></icon>
|
<icon name="add" [flex]="true"></icon>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
|
||||||
import {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
|
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
|
||||||
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
import {zip} from "rxjs";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -207,12 +208,28 @@ export class SearchDataProvidersComponent {
|
||||||
parametersFull = parameters;
|
parametersFull = parameters;
|
||||||
refineQueryFull = refineFieldsFilterQuery+(refineFieldsFilterQuery.length > 0 && datasourceQueryPrefix.length >0 ? "&" : "")+(datasourceQueryPrefix.length>0 ? "fq=" : "")+datasourceQueryPrefix;
|
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(
|
let filterQueries;
|
||||||
.subscribe(
|
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 => {
|
data => {
|
||||||
let totalResults = data[0];
|
let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
|
||||||
let filters = data[2];
|
let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
|
||||||
|
|
||||||
this.filtersReturned(refine, filters, totalResults, page);
|
this.filtersReturned(refine, filters, totalResults, page);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
|
@ -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 {properties} from "../../../environments/environment";
|
import {properties} from "../../../environments/environment";
|
||||||
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
import {zip} from "rxjs";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -169,12 +170,28 @@ 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, true)
|
|
||||||
//.switchMap(
|
let filterQueries;
|
||||||
.subscribe(
|
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 => {
|
data => {
|
||||||
let totalResults = data[0];
|
let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
|
||||||
let filters = data[2];
|
let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
|
||||||
|
|
||||||
this.filtersReturned(refine, filters, totalResults, page);
|
this.filtersReturned(refine, filters, totalResults, page);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {NewSearchPageComponent, SearchForm} from "./searchUtils/newSearchPage.co
|
||||||
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";
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
import {zip} from "rxjs";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-projects',
|
selector: 'search-projects',
|
||||||
|
@ -174,30 +175,45 @@ 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, true)
|
|
||||||
//.switchMap(
|
let filterQueries;
|
||||||
.subscribe(
|
let filterIds = [];
|
||||||
data => {
|
let fields = this.searchPage.getFields();
|
||||||
let totalResults = data[0];
|
for(let filter of this.searchPage.URLCreatedFilters) {
|
||||||
let filters = data[2];
|
filterIds.push(filter.filterId);
|
||||||
this.filtersReturned(refine, filters, totalResults, page);
|
fields = fields.filter(field => field != filter.filterId);
|
||||||
|
}
|
||||||
},
|
|
||||||
err => {
|
if(filterIds.length > 0) {
|
||||||
this.filters = this.searchPage.prepareFiltersToShow([], 0);
|
filterQueries = zip(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(filterIds) : null, filterIds, refineFieldsFilterQuery, false),
|
||||||
this.rangeFilters = this.searchPage.prepareRangeFiltersToShow();
|
this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery(fields) : null, fields, refineFieldsFilterQuery, true)
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
} 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 {StringUtils} from "../utils/string-utils.class";
|
||||||
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
|
import {RefineResultsUtils} from "../services/servicesUtils/refineResults.class";
|
||||||
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
import {RefineFieldResultsService} from "../services/refineFieldResults.service";
|
||||||
|
import {zip} from "rxjs";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-research-results',
|
selector: 'search-research-results',
|
||||||
|
@ -253,13 +254,27 @@ export class SearchResearchResultsComponent {
|
||||||
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._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)
|
let filterQueries;
|
||||||
//.switchMap(
|
let filterIds = [];
|
||||||
.subscribe(
|
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 => {
|
data => {
|
||||||
let totalResults = data[0];
|
let totalResults = filterIds.length > 0 ? data[0][0] : data[0];
|
||||||
let filters = data[2];
|
let filters = filterIds.length > 0 ? data[0][2].concat(data[1][2]) : data[2];
|
||||||
|
|
||||||
// if (refine) {
|
// if (refine) {
|
||||||
// this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults);
|
// 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&...))
|
* Get a query string of all fields, that want to get from search (e.g. &fields=funderid&fields=projectstartyear&...))
|
||||||
*/
|
*/
|
||||||
public getRefineFieldsQuery(): string {
|
public getRefineFieldsQuery(fields: string[] = null): string {
|
||||||
|
|
||||||
var fields: string[] = this.getFields();
|
if(!fields) {
|
||||||
|
fields = this.getFields();
|
||||||
|
}
|
||||||
var fieldsStr = ""
|
var fieldsStr = ""
|
||||||
for (var i = 0; i < fields.length; i++) {
|
for (var i = 0; i < fields.length; i++) {
|
||||||
fieldsStr += "&fields=" + fields[i];
|
fieldsStr += "&fields=" + fields[i];
|
||||||
|
@ -1816,10 +1818,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
this.showUnknownFilters = true;
|
this.showUnknownFilters = true;
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, this.URLCreatedStaticFilters, true);
|
this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, this.URLCreatedStaticFilters, true);
|
||||||
//this.checkSelectedRangeFilters(this.rangeFilters);
|
//this.checkSelectedRangeFilters(this.rangeFilters);
|
||||||
|
|
||||||
this.checkSelectedFilters(this.filters);
|
this.checkSelectedFilters(this.filters);
|
||||||
this.countSelectedFilters(this.filters);
|
this.countSelectedFilters(this.filters);
|
||||||
this.updateMeta(this.pageTitle);
|
this.updateMeta(this.pageTitle);
|
||||||
|
|
Loading…
Reference in New Issue