mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2189] new search facets (#3230)
* slider facet * number range facet * unit tests * remove fdescribe * remove old demo-only content * remove old tests * Support "include" and "field" values with app config * exclude deprecated demo content from export checks
This commit is contained in:
committed by
Eugenio Romano
parent
b7fc44d576
commit
3a51c27f66
@@ -33,8 +33,6 @@ export class SearchQueryBuilderService {
|
||||
|
||||
categories: Array<SearchCategory> = [];
|
||||
queryFragments: { [id: string]: string } = {};
|
||||
fields: { [id: string]: string[] } = {};
|
||||
scope: { locations?: string };
|
||||
filterQueries: FilterQuery[] = [];
|
||||
ranges: { [id: string]: SearchRange } = {};
|
||||
paging: { maxItems?: number; skipCount?: number } = null;
|
||||
@@ -52,9 +50,6 @@ export class SearchQueryBuilderService {
|
||||
}
|
||||
|
||||
this.filterQueries = this.config.filterQueries || [];
|
||||
this.scope = {
|
||||
locations: null
|
||||
};
|
||||
}
|
||||
|
||||
addFilterQuery(query: string): void {
|
||||
@@ -93,7 +88,6 @@ export class SearchQueryBuilderService {
|
||||
|
||||
buildQuery(): QueryBody {
|
||||
let query = '';
|
||||
const fields: string[] = [];
|
||||
|
||||
this.categories.forEach(facet => {
|
||||
const customQuery = this.queryFragments[facet.id];
|
||||
@@ -103,17 +97,13 @@ export class SearchQueryBuilderService {
|
||||
}
|
||||
query += `(${customQuery})`;
|
||||
}
|
||||
|
||||
const customFields = this.fields[facet.id];
|
||||
if (customFields && customFields.length > 0) {
|
||||
for (const field of customFields) {
|
||||
if (!fields.includes(field)) {
|
||||
fields.push(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const include = this.config.include || [];
|
||||
if (include.length === 0) {
|
||||
include.push('path', 'allowableOperations');
|
||||
}
|
||||
|
||||
if (query) {
|
||||
|
||||
const result: QueryBody = {
|
||||
@@ -121,14 +111,12 @@ export class SearchQueryBuilderService {
|
||||
query: query,
|
||||
language: 'afts'
|
||||
},
|
||||
include: ['path', 'allowableOperations'],
|
||||
fields: fields,
|
||||
include: include,
|
||||
paging: this.paging,
|
||||
fields: this.config.fields,
|
||||
filterQueries: this.filterQueries,
|
||||
facetQueries: this.config.facetQueries,
|
||||
facetFields: this.config.facetFields,
|
||||
limits: this.config.limits,
|
||||
scope: this.scope
|
||||
facetFields: this.config.facetFields
|
||||
};
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user