mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3497] Facet intervals on search filter (#4255)
* [ADF-3497] allow facetIntervals on search * [ADF-3497] update schema json * [ADF-3497] update json * [ADF-3497] documentation update * [ADF-3497] specify that sets are not supported * [ADF-3497] no spaces on labels - mention * [ADF-3497] documentation update * [ADF-3497] update examples & document label key * [ADF-3497] tests added * [ADF-3497] testRail id * [ADF-3497] allow config of custom pageSize values * [ADF-3497] support mincount filtering also for intervals * [ADF-3497] support expanded property also for facetIntervals * remove no longer needed info - bcs. of PR #4322 fix
This commit is contained in:
committed by
Eugenio Romano
parent
f20a71438c
commit
e34f80aff7
@@ -224,6 +224,7 @@ export class SearchQueryBuilderService {
|
||||
fields: this.config.fields,
|
||||
filterQueries: this.filterQueries,
|
||||
facetQueries: this.facetQueries,
|
||||
facetIntervals: this.facetIntervals,
|
||||
facetFields: this.facetFields,
|
||||
sort: this.sort
|
||||
};
|
||||
@@ -280,6 +281,20 @@ export class SearchQueryBuilderService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if FacetIntervals has been defined
|
||||
* @returns True if defined, false otherwise
|
||||
*/
|
||||
get hasFacetIntervals(): boolean {
|
||||
if (this.config
|
||||
&& this.config.facetIntervals
|
||||
&& this.config.facetIntervals.intervals
|
||||
&& this.config.facetIntervals.intervals.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected get sort(): RequestSortDefinitionInner[] {
|
||||
return this.sorting.map((def) => {
|
||||
return new RequestSortDefinitionInner({
|
||||
@@ -301,6 +316,22 @@ export class SearchQueryBuilderService {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected get facetIntervals(): any {
|
||||
if (this.hasFacetIntervals) {
|
||||
const configIntervals = this.config.facetIntervals;
|
||||
|
||||
return {
|
||||
intervals: configIntervals.intervals.map((interval) => <any> {
|
||||
label: interval.label,
|
||||
field: interval.field,
|
||||
sets: interval.sets
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected getFinalQuery(): string {
|
||||
let query = '';
|
||||
|
||||
|
Reference in New Issue
Block a user