mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
76 lines
2.3 KiB
Markdown
76 lines
2.3 KiB
Markdown
---
|
|
Added: v2.3.0
|
|
Status: Active
|
|
---
|
|
|
|
# Search Query Builder service
|
|
|
|
Stores information from all the custom search and faceted search widgets, compiles and runs the final Search query.
|
|
|
|
## Class members
|
|
|
|
### Methods
|
|
|
|
- **addFilterQuery**(query: `string` = `null`)<br/>
|
|
|
|
- _query:_ `string` -
|
|
|
|
- **buildQuery**(): `QueryBody`<br/>
|
|
|
|
- **Returns** `QueryBody` -
|
|
|
|
- **execute**(): `Promise<void>`<br/>
|
|
|
|
- **Returns** `Promise<void>` -
|
|
|
|
- **getFacetField**(label: `string` = `null`): [`FacetField`](../../lib/content-services/search/facet-field.interface.ts)<br/>
|
|
|
|
- _label:_ `string` -
|
|
- **Returns** [`FacetField`](../../lib/content-services/search/facet-field.interface.ts) -
|
|
|
|
- **getFacetQuery**(label: `string` = `null`): [`FacetQuery`](../../lib/content-services/search/facet-query.interface.ts)<br/>
|
|
|
|
- _label:_ `string` -
|
|
- **Returns** [`FacetQuery`](../../lib/content-services/search/facet-query.interface.ts) -
|
|
|
|
- **getPrimarySorting**(): [`SearchSortingDefinition`](../../lib/content-services/search/search-sorting-definition.interface.ts)<br/>
|
|
Returns primary sorting definition.
|
|
- **Returns** [`SearchSortingDefinition`](../../lib/content-services/search/search-sorting-definition.interface.ts) -
|
|
- **getSortingOptions**(): [`SearchSortingDefinition`](../../lib/content-services/search/search-sorting-definition.interface.ts)`[]`<br/>
|
|
Returns all pre-configured sorting options that users can choose from.
|
|
- **Returns** [`SearchSortingDefinition`](../../lib/content-services/search/search-sorting-definition.interface.ts)`[]` -
|
|
- **removeFilterQuery**(query: `string` = `null`)<br/>
|
|
|
|
- _query:_ `string` -
|
|
|
|
- **update**()<br/>
|
|
|
|
## Details
|
|
|
|
The Query Builder is UI agnostic and does not rely on Angular components.
|
|
You can reuse it with multiple component implementations.
|
|
|
|
You can use custom widgets to populate and edit the following parts of the resulting query:
|
|
|
|
- categories
|
|
- query fragments that form query expression
|
|
- include fields
|
|
- scope settings
|
|
- filter queries
|
|
- facet fields
|
|
- range queries
|
|
|
|
```ts
|
|
constructor(queryBuilder: SearchQueryBuilderService) {
|
|
|
|
queryBuilder.updated.subscribe(query => {
|
|
this.queryBuilder.execute();
|
|
});
|
|
|
|
queryBuilder.executed.subscribe(data => {
|
|
this.onDataLoaded(data);
|
|
});
|
|
|
|
}
|
|
```
|