[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:
Suzana Dirla
2019-02-18 20:51:15 +02:00
committed by Eugenio Romano
parent f20a71438c
commit e34f80aff7
11 changed files with 368 additions and 21 deletions

View File

@@ -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 = '';