* [ADF-2824] Moved search widget docs into separate pages * [ADF-2824] Separated search widget page and added search filter service docs * [ADF-2824] Updated new search docs with doc tools
3.3 KiB
Added, Status, Last reviewed
Added | Status | Last reviewed |
---|---|---|
v2.3.0 | Active | 2018-06-12 |
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
)
Adds a new filter query.- query:
string
- Text of the query to add
- query:
-
buildQuery():
QueryBody
Builds a new query using the added elements.- Returns
QueryBody
- The resulting query
- Returns
-
execute():
Promise
<void>
Executes the query.- Returns
Promise
<void>
- Notification of query completion
- Returns
-
getFacetField(label:
string
=null
):FacetField
Gets the details of a facet field.- label:
string
- Identifying label of the facet field - Returns
FacetField
- Facet field details
- label:
-
getFacetQuery(label:
string
=null
):FacetQuery
Gets the details of a facet query- label:
string
- Identifying label of the facet query - Returns
FacetQuery
- Details of the facet query
- label:
-
getPrimarySorting():
SearchSortingDefinition
Returns primary sorting definition.- Returns
SearchSortingDefinition
- Sorting definition
- Returns
-
getSortingOptions():
SearchSortingDefinition
[]
Returns all pre-configured sorting options that users can choose from.- Returns
SearchSortingDefinition
[]
- List of available sorting options
- Returns
-
removeFilterQuery(query:
string
=null
)
Removes a previously added filter query.- query:
string
- The query to remove
- query:
-
update()
Builds the query and notifies subscribers when complete.
Details
See the Search filter component page for full details about the format of queries, facet fields, and sorting options.
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 a query expression
- include fields
- scope settings
- filter queries
- facet fields
- range queries
constructor(queryBuilder: SearchQueryBuilderService) {
queryBuilder.updated.subscribe(query => {
this.queryBuilder.execute();
});
queryBuilder.executed.subscribe(data => {
this.onDataLoaded(data);
});
}