[ACS-6644] Updated config guide, added build example, fixed mistakes (#9700)

This commit is contained in:
Grzegorz Jaśkowski
2024-06-04 15:05:24 +02:00
committed by GitHub
parent 6c740bc35c
commit 376969ae42
12 changed files with 347 additions and 81 deletions

View File

@@ -2,12 +2,12 @@
Title: Search check list component Title: Search check list component
Added: v2.4.0 Added: v2.4.0
Status: Active Status: Active
Last reviewed: 2024-04-05 Last reviewed: 2024-05-13
--- ---
# [Search check list component](../../../lib/content-services/src/lib/search/components/search-check-list/search-check-list.component.ts "Defined in search-check-list.component.ts") # [Search check list component](../../../lib/content-services/src/lib/search/components/search-check-list/search-check-list.component.ts "Defined in search-check-list.component.ts")
Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 4 inputs representing logical conditions to form search query from. Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of a list of checkboxes representing filters included in search query.
![Check list widget screenshot](../../docassets/images/search-check-list.png) ![Check list widget screenshot](../../docassets/images/search-check-list.png)

View File

@@ -2,7 +2,7 @@
Title: Search filter tabbed component Title: Search filter tabbed component
Added: v6.2.0 Added: v6.2.0
Status: Active Status: Active
Last reviewed: 2023-07-10 Last reviewed: 2024-05-14
--- ---
# [Search filter tabbed component](../../../lib/content-services/src/lib/search/components/search-filter-tabbed/search-filter-tabbed.component.ts "Defined in search-filter-tabbed.component.ts") # [Search filter tabbed component](../../../lib/content-services/src/lib/search/components/search-filter-tabbed/search-filter-tabbed.component.ts "Defined in search-filter-tabbed.component.ts")
@@ -34,7 +34,7 @@ with the name input property being assigned the value of whatever name should be
- [Search Widget Interface](../interfaces/search-widget.interface.md) - [Search Widget Interface](../interfaces/search-widget.interface.md)
- [Search check list component](search-check-list.component.md) - [Search check list component](search-check-list.component.md)
- [Search date range component](search-date-range.component.md) - [Search date range component](search-date-range.component.md)
- [Search date range component](search-date-range.component.md) - [Search date range tabbed component](search-date-range-tabbed.component.md)
- [Search number range component](search-number-range.component.md) - [Search number range component](search-number-range.component.md)
- [Search radio component](search-radio.component.md) - [Search radio component](search-radio.component.md)
- [Search slider component](search-slider.component.md) - [Search slider component](search-slider.component.md)

View File

@@ -2,15 +2,23 @@
Title: Search Form component Title: Search Form component
Added: v4.5.0 Added: v4.5.0
Status: Active Status: Active
Last reviewed: 2021-06-11 Last reviewed: 2024-05-14
--- ---
# [Search Form component](../../../lib/content-services/src/lib/search/components/search-form/search-form.component.ts "Defined in search-form.component.ts") # [Search Form component](../../../lib/content-services/src/lib/search/components/search-form/search-form.component.ts "Defined in search-form.component.ts")
Implements a component consisting of a menu populated with search filter sets.
![Search Form screenshot](../../docassets/images/search-form-component.png) ![Search Form screenshot](../../docassets/images/search-form-component.png)
## Basic usage ## Basic usage
### In .html files
```html
<adf-search-form></adf-search-form>
```
### In app config
```json ```json
{ {
"search": [ "search": [
@@ -26,10 +34,9 @@ Last reviewed: 2021-06-11
} }
``` ```
## Details ## Details
This component pick a configuration for a search from the list of configuration. This component allows user to choose between search filter sets specified in configuration.
## See also ## See also

View File

@@ -49,7 +49,7 @@ user types `test`
user types `*` user types `*`
```text ```text
(cm:name:"**" OR cm:title:"**" OR cm:description:"**" OR TEXT:"**" OR TAG:"**") (cm:name:"*" OR cm:title:"*" OR cm:description:"*" OR TEXT:"*" OR TAG:"*")
``` ```
user types `one two` user types `one two`

View File

@@ -2,12 +2,12 @@
Title: Search number range component Title: Search number range component
Added: v2.4.0 Added: v2.4.0
Status: Active Status: Active
Last reviewed: 2024-04-05 Last reviewed: 2024-05-03
--- ---
# [Search number range component](../../../lib/content-services/src/lib/search/components/search-number-range/search-number-range.component.ts "Defined in search-number-range.component.ts") # [Search number range component](../../../lib/content-services/src/lib/search/components/search-number-range/search-number-range.component.ts "Defined in search-number-range.component.ts")
Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 4 inputs representing logical conditions to form search query from. Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 2 inputs accepting numerical values, representing start and end of a numerical parameter's range used as a search query parameter.
![Number Range Widget](../../docassets/images/search-number-range.png) ![Number Range Widget](../../docassets/images/search-number-range.png)

View File

@@ -2,12 +2,12 @@
Title: Search radio component Title: Search radio component
Added: v2.4.0 Added: v2.4.0
Status: Active Status: Active
Last reviewed: 2024-04-05 Last reviewed: 2024-05-13
--- ---
# [Search radio component](../../../lib/content-services/src/lib/search/components/search-radio/search-radio.component.ts "Defined in search-radio.component.ts") # [Search radio component](../../../lib/content-services/src/lib/search/components/search-radio/search-radio.component.ts "Defined in search-radio.component.ts")
Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 4 inputs representing logical conditions to form search query from. Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of a list of radio buttons representing filters included in search query.
![Radio Widget screenshot](../../docassets/images/search-radio.png) ![Radio Widget screenshot](../../docassets/images/search-radio.png)

View File

@@ -2,12 +2,12 @@
Title: Search slider component Title: Search slider component
Added: v2.4.0 Added: v2.4.0
Status: Active Status: Active
Last reviewed: 2024-04-05 Last reviewed: 2024-05-13
--- ---
# [Search slider component](../../../lib/content-services/src/lib/search/components/search-slider/search-slider.component.ts "Defined in search-slider.component.ts") # [Search slider component](../../../lib/content-services/src/lib/search/components/search-slider/search-slider.component.ts "Defined in search-slider.component.ts")
Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 4 inputs representing logical conditions to form search query from. Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of a slider for numerical parameter value selection used as a search query parameter.
![Slider Widget](../../docassets/images/search-slider.png) ![Slider Widget](../../docassets/images/search-slider.png)

View File

@@ -2,12 +2,12 @@
Title: Search text component Title: Search text component
Added: v2.4.0 Added: v2.4.0
Status: Active Status: Active
Last reviewed: 2024-04-05 Last reviewed: 2024-05-13
--- ---
# [Search text component](../../../lib/content-services/src/lib/search/components/search-text/search-text.component.ts "Defined in search-text.component.ts") # [Search text component](../../../lib/content-services/src/lib/search/components/search-text/search-text.component.ts "Defined in search-text.component.ts")
Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of 4 inputs representing logical conditions to form search query from. Implements a [search widget](../../../lib/content-services/src/lib/search/models/search-widget.interface.ts) consisting of a input representing a value used in search query to specify field contents.
![Text Widget](../../docassets/images/search-text.png) ![Text Widget](../../docassets/images/search-text.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -0,0 +1,170 @@
---
Title: Search Building
Added: 2024-05-17
---
# Search Building
This page covers the basics of creating a search page using components from this repository.
**Note:** Styling is covered only to a minimal necessary extent.
## Contents
- [Basic Implementation](#basic-implementation)
- [Used Components](#used-components)
- [Used Services](#used-services)
- [Template](#template)
- [Component](#component)
- [Search Configuration](#search-configuration)
- [Used Components](#used-components-1)
- [Template](#template-1)
- [Component](#component-1)
## Basic Implementation
Most basic search requires only three components to be included in the template.
Search is executed on *Enter* key press and the results are shown below.
![Simple Search](../docassets/images/simple-search-example.png)
For details of used properties, methods and events please refer to documentation pages covering the components and services, linked in the tables below and [See Also](#see-also) section.
### Used Components
|Name|Selector|Description|
|----|--------|-----------|
|[Search Input Component](../content-services/components/search-input.component.md)|`<adf-search-input>`|Manages, formats and emits user input on search.|
|[Document List Component](../content-services/components/document-list.component.md)|`<adf-document-list>`|Displays search results.|
|[Pagination Component](../core/components/pagination.component.md)|`<adf-pagination>`|Allows to alternate between search results pages.|
### Used Services
|Name|Description|
|----|-----------|
|[Search Query Builder Service](../content-services/services/search-query-builder.service.md)|Creates, formats and executes search query|
### Template
```html
<adf-search-input
[fields]="['cm:name', 'cm:title', 'cm:description', 'TEXT', 'TAG']"
(changed)="onSearchQueryChanged($event)"
>
</adf-search-input>
<adf-document-list style="overflow-y: auto;"
#documentList
[sortingMode]="'client'"
[node]="$any(data)"
>
</adf-document-list>
<adf-pagination
[target]="documentList"
(change)="onPaginationChanged($event)"
>
</adf-pagination>
```
### Component
```ts
@Component({
standalone: true,
imports: [SearchInputComponent, DocumentListModule, SearchModule, PaginationDirective, PaginationComponent],
selector: 'your-search',
templateUrl: './your-search.component.html',
styleUrls: ['./your-search.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class YourSearchComponent implements OnInit {
data: ResultSetPaging;
constructor(private queryBuilder: SearchQueryBuilderService) {
queryBuilder.paging = {
skipCount: 0,
maxItems: 25
};
}
ngOnInit() {
this.queryBuilder.resetToDefaults();
this.queryBuilder.updated.subscribe(() => void this.queryBuilder.execute());
this.queryBuilder.executed.subscribe((data) => {
this.queryBuilder.paging.skipCount = 0;
this.onSearchResultLoaded(data);
});
}
onSearchResultLoaded(resultSetPaging: ResultSetPaging) {
this.data = resultSetPaging;
}
onSearchQueryChanged(string: string) {
this.queryBuilder.userQuery = decodeURIComponent(string);
this.queryBuilder.update();
}
async onPaginationChanged(pagination: Pagination) {
this.queryBuilder.paging = {
maxItems: pagination.maxItems,
skipCount: pagination.skipCount
};
this.queryBuilder.update();
}
}
```
## Search Configuration
Adding those two components allows for usage of search configurations and switching between them.
![Search With Configs](../docassets/images/search-with-configs-example.png)
### Used Components
|Name|Selector|Description|
|----|--------|-----------|
|[Search Form Component](../content-services/components/search-form.component.md)|`<adf-search-form>`|Allows to switch search configurations.|
|[Search Filter Chips](../content-services/components/search-filter-chips.component.md)|`<adf-search-filter-chips>`|Container that displays customisable search filters from configuration.|
For more information about search configuration please refer to [Search Configuration Guide](./search-configuration-guide.md).
### Template
Place those components below search input for the same layout as shown on the picture above.
```html
...
<div style="diplay: flex;">
<adf-search-form></adf-search-form>
<adf-search-filter-chips></adf-search-filter-chips>
</div>
...
```
### Component
When adding those two components you need to remove one subscription from the `ngOnInit()`. No additional methods and properties are required.
```ts
...
ngOnInit() {
this.queryBuilder.resetToDefaults();
this.queryBuilder.executed.subscribe((data) => {
this.queryBuilder.paging.skipCount = 0;
this.onSearchResultLoaded(data);
});
}
...
```
## See Also
- [Search Configuration Guide](search-configuration-guide.md)
- [Search Input Component](../content-services/components/search-input.component.md)
- [Document List Component](../content-services/components/document-list.component.md)
- [Pagination Component](../core/components/pagination.component.md)
- [Search Form Component](../content-services/components/search-form.component.md)
- [Search Filter Chips](../content-services/components/search-filter-chips.component.md)
- [Search Query Builder Service](../content-services/services/search-query-builder.service.md)

View File

@@ -34,8 +34,10 @@ ADF support single or multiple [search configurations](https://github.com/Alfres
{ {
"search": { "search": {
"name": "Application search", "name": "Application search",
"query": [ "default": true,
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" } "filteredWithContaints": true,
"filterQueryies": [
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
], ],
"category": [] "category": []
} }
@@ -50,16 +52,19 @@ This configuration considered for searching in the application.
{ {
"search": [ "search": [
{ {
"name": "Application search", "name": "Application default search",
"default": "true", "default": true,
"query": [ "filteredWithContaints": true,
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" } "filterQueries": [
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
] ]
}, },
{ {
"name": "Customer payout", "name": "Application secondary search",
"query": [ "default": false,
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" } "filteredWithContaints": true,
"filterQueries": [
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
{ "query": "-TYPE:'st:site' AND -ASPECT:'st:siteContainer' AND -ASPECT:'sys:hidden'" } { "query": "-TYPE:'st:site' AND -ASPECT:'st:siteContainer' AND -ASPECT:'sys:hidden'" }
] ]
} }
@@ -108,41 +113,74 @@ A typical configuration is shown below:
```json ```json
{ {
"search": { "search": {
"name": "Application search",
"default": true,
"filterWithContains": true,
"sorting": { "sorting": {
"options": [ "options": [
{ "key": "name", "label": "Name", "type": "FIELD", "field": "cm:name", "ascending": true }, {
{ "key": "content.sizeInBytes", "label": "Size", "type": "FIELD", "field": "content.size", "ascending": true }, "key": "name",
{ "key": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true } "label": "Name",
"type": "FIELD",
"field": "cm:name",
"ascending": true
},
], ],
"defaults": [ "defaults": [
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true } {
"key": "name",
"type": "FIELD",
"field": "cm:name",
"ascending": true
}
] ]
}, },
"filterQueries": [ "filterQueries": [
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" }, { "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" },
{ "query": "NOT cm:creator:System" } { "query": "-cm:creator:System" }
], ],
"facetFields": {
"expanded": true,
"fields": [
{ "field": "content.mimetype", "mincount": 1, "label": "Type" },
{ "field": "content.size", "mincount": 1, "label": "File Size" },
{ "field": "creator", "mincount": 1, "label": "Creator" },
{ "field": "modifier", "mincount": 1, "label": "Modifier" }
]
},
"facetQueries": { "facetQueries": {
"mincount": 1,
"label": "My facet queries", "label": "My facet queries",
"pageSize": 4, "pageSize": 4,
"expanded": true,
"queries": [ "queries": [
{ "query": "created:2018", "label": "Created This Year" },
{ "query": "content.mimetype:text/html", "label": "Type: HTML" }, { "query": "content.mimetype:text/html", "label": "Type: HTML" },
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small"}, { "query": "content.size:[0 TO 10240]", "label": "Size: xtra small" },
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small"}, { "query": "content.size:[10240 TO 102400]", "label": "Size: small" },
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium" }, { "query": "content.size:[102400 TO 1048576]", "label": "Size: medium" },
{ "query": "content.size:[1048576 TO 16777216]", "label": "Size: large" }, { "query": "content.size:[1048576 TO 16777216]", "label": "Size: large"},
{ "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large" }, { "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large" },
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large" } { "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large" }
],
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true
}
},
"facetFields": {
"expanded": true,
"fields": [
{
"field": "content.mimetype",
"mincount": 1,
"label": "Type",
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"facetOrder": 100
}
},
{
"field": "creator",
"mincount": 1,
"label": "Creator",
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"facetOrder": 200
}
},
] ]
}, },
"categories": [ "categories": [
@@ -150,10 +188,11 @@ A typical configuration is shown below:
"id": "queryName", "id": "queryName",
"name": "Name", "name": "Name",
"enabled": true, "enabled": true,
"expanded": true,
"component": { "component": {
"selector": "adf-search-text", "selector": "text",
"settings": { "settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"pattern": "cm:name:'(.*?)'", "pattern": "cm:name:'(.*?)'",
"field": "cm:name", "field": "cm:name",
"placeholder": "Enter the name" "placeholder": "Enter the name"
@@ -178,7 +217,9 @@ results:
```json ```json
{ {
"search": { "search": {
...
"include": ["path", "allowableOperations"] "include": ["path", "allowableOperations"]
...
} }
} }
``` ```
@@ -188,7 +229,9 @@ You can choose to filter facet field results using 'contains' instead of 'starts
```json ```json
{ {
"search": { "search": {
...
"filterWithContains": true "filterWithContains": true
...
} }
} }
``` ```
@@ -199,7 +242,9 @@ This 'clean up' button would make it easier for the final user to remove all buc
```json ```json
{ {
"search": { "search": {
...
"resetButton": true "resetButton": true
...
} }
} }
``` ```
@@ -210,10 +255,12 @@ settings:
```json ```json
{ {
"search": { "search": {
...
"filterQueries": [ "filterQueries": [
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" }, { "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" },
{ "query": "NOT cm:creator:System" } { "query": "-cm:creator:System" }
] ]
...
} }
} }
``` ```
@@ -248,15 +295,13 @@ The properties of the `options` objects are as follows:
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| key | string | Unique key to identify the entry. This can also be used to map [`DataColumn`](../../../lib/core/datatable/data/data-column.model.ts) instances. | | key | string | Unique key to identify the entry. This can also be used to map [`DataColumn`](../../lib/core/src/lib/datatable/data/data-column.model.ts) instances. |
| label | string | Display text, which can also be an [i18n resource key](../../user-guide/internationalization.md). | | label | string | Display text, which can also be an [i18n resource key](../user-guide/internationalization.md). |
| type | string | This specifies how to order the results. It can be based on a field, based on the position of the document in the index, or by score/relevance. | | type | string | This specifies how to order the results. It can be based on a field, based on the position of the document in the index, or by score/relevance. |
| field | string | The name of the field. | | field | string | The name of the field. |
| ascending | boolean | The sorting order defined as `true` for ascending order and `false` for descending order | | ascending | boolean | The sorting order defined as `true` for ascending order and `false` for descending order |
See the [Sort](https://docs.alfresco.com/5.2/concepts/search-api-sort.html) See the information on sorting in the [Search API](../../lib/js-api/src/api/search-rest-api/docs/SearchApi.md) for further details.
element in the [ACS Search API](https://docs.alfresco.com/5.2/concepts/search-api.html)
for further details.
### Categories and widgets ### Categories and widgets
@@ -295,9 +340,12 @@ The Search Filter supports a number of components out of the box, each implement
| Widget name | Selector | Description | | Widget name | Selector | Description |
|----------------------------------------------------------------------------------------------| -------- |------------------------------------------------------------------------------| |----------------------------------------------------------------------------------------------| -------- |------------------------------------------------------------------------------|
| [Check List](../content-services/components/search-check-list.component.md) | `check-list` | Toggles individual query fragments for the search | | [Check List](../content-services/components/search-check-list.component.md) | `check-list` | Toggles individual query fragments for the search |
| [Date Range](../content-services/components/search-date-range.component.md) | `date-range` | Specifies a varities of options for selecting dates that a field may contain | | [Date Range](../content-services/components/search-date-range.component.md) | `date-range` | Allows for selecting date range for a field containing dates |
| [Date Time Range](../content-services/components/search-datetime-range.component.md) | `datetime-range` | Allows for selecting date and time rande for a field containing dates |
| [Number Range](../content-services/components/search-number-range.component.md) | `number-range` | Specifies a range of numeric values that a field may contain | | [Number Range](../content-services/components/search-number-range.component.md) | `number-range` | Specifies a range of numeric values that a field may contain |
| [Radio List](../content-services/components/search-radio.component.md) | `radio` | Selects one query fragment from a list of options | | [Radio List](../content-services/components/search-radio.component.md) | `radio` | Selects one query fragment from a list of options |
| [Search Filter Autocomplete](../content-services/components/search-filter-autocomplete-chips.component.md) | `autocomplete-chips` | Provides an input with autocomplete options representing conditions to form search query |
| [Search Logical Filter](../content-services/components/search-logical-filter.component.md) | `logical-filter` | Provides 4 inputs representing logical conditions to form search query from |
| [Slider](../content-services/components/search-slider.component.md) | `slider` | Selects a single numeric value in a given range that a field may contain | | [Slider](../content-services/components/search-slider.component.md) | `slider` | Selects a single numeric value in a given range that a field may contain |
| [Text](../content-services/components/search-text.component.md) | `text` | Specifies a text value that a field may contain | | [Text](../content-services/components/search-text.component.md) | `text` | Specifies a text value that a field may contain |
@@ -338,11 +386,26 @@ export interface SearchWidgetSettings {
"facetFields": { "facetFields": {
"expanded": true, "expanded": true,
"fields": [ "fields": [
{ "field": "content.mimetype", "mincount": 1, "label": "Type" }, {
{ "field": "content.size", "mincount": 1, "label": "File Size" }, "field": "content.mimetype",
{ "field": "creator", "mincount": 1, "label": "Creator" }, "mincount": 1,
{ "field": "modifier", "mincount": 1, "label": "Modifier" }, "label": "Type",
{ "field": "created", "mincount": 1, "label": "Created" } "settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"facetOrder": 100
}
},
{
"field": "creator",
"mincount": 1,
"label": "Creator",
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true,
"facetOrder": 200
}
},
] ]
} }
} }
@@ -370,6 +433,17 @@ Note: Facet Fields setting can be controlled by passing [settings](../../lib/con
| limit | number | | Maximum number of results | | limit | number | | Maximum number of results |
| pageSize | number | 5 | Display page size | | pageSize | number | 5 | Display page size |
| offset | number | | Offset position | | offset | number | | Offset position |
| settings | [FacetFieldSettings](../../lib/content-services/src/lib/search/models/facet-field.interface.ts) | | Settings allowing for controlling fields behavior and order |
#### FacetFieldSetting
| Name | Type | Default | Description |
|------|------|---------|-------------|
|allowUpdateOnChange|`boolean`|*false*|Specifies whether search should be executed automatically after FacetField value changes.|
|hideDefaultAction|`boolean`|*true*|Specifies whether default field actions should be visible.|
|facetOrder|`number`||Specifies the order of facets. Lower numbers are displayed first.|
|bucketSortBy|`string`||Specifies sort criteria of facet queries. Possible values are "LABEL" and "COUNT".|
|bucketSortDirection|`string`||Specifies sort order of facet queries. Possible values are "ASCENDING" and "DESCENDING".|
### Facet Queries ### Facet Queries
@@ -379,19 +453,23 @@ These provide custom categories based on admin-defined facet queries.
{ {
"search": { "search": {
"facetQueries": { "facetQueries": {
"label": "Facet queries", "mincount": 1,
"pageSize": 5, "label": "My facet queries",
"pageSize": 4,
"expanded": true, "expanded": true,
"queries": [ "queries": [
{ "query": "created:2018", "label": "Created This Year" },
{ "query": "content.mimetype:text/html", "label": "Type: HTML" }, { "query": "content.mimetype:text/html", "label": "Type: HTML" },
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small"}, { "query": "content.size:[0 TO 10240]", "label": "Size: xtra small" },
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small"}, { "query": "content.size:[10240 TO 102400]", "label": "Size: small" },
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium" }, { "query": "content.size:[102400 TO 1048576]", "label": "Size: medium" },
{ "query": "content.size:[1048576 TO 16777216]", "label": "Size: large" }, { "query": "content.size:[1048576 TO 16777216]", "label": "Size: large"},
{ "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large" }, { "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large" },
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large" } { "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large" }
] ],
"settings": {
"allowUpdateOnChange": false,
"hideDefaultAction": true
}
} }
} }
} }
@@ -414,17 +492,18 @@ If you need to display more resulting collapsible categories, you can group diff
"expanded": true, "expanded": true,
"mincount": 0, "mincount": 0,
"queries": [ "queries": [
{ "query": "created:2018", "label": "Created This Year" }, { "query": "content.mimetype:text/html", "label": "Type: HTML", "group": "Type facet queries" },
{ "query": "modifier:admin", "label": "Admin modifier" }, { "query": "content.size:[0 TO 10240]", "label": "Size: xtra small", "group": "Size facet queries"},
{ "query": "content.mimetype:text/html", "label": "Type: HTML", "group":"Type facet queries" }, { "query": "content.size:[10240 TO 102400]", "label": "Size: small", "group": "Size facet queries"},
{ "query": "content.mimetype:image/png", "label": "Type: PNG", "group":"Type facet queries" }, { "query": "content.size:[102400 TO 1048576]", "label": "Size: medium", "group": "Size facet queries" },
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small", "group":"Size facet queries"}, { "query": "content.size:[1048576 TO 16777216]", "label": "Size: large", "group": "Size facet queries" },
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small", "group":"Size facet queries"}, { "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large", "group": "Size facet queries" },
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium", "group":"Size facet queries" }, { "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large", "group": "Size facet queries" }
{ "query": "content.size:[1048576 TO 16777216]", "label": "Size: large", "group":"Size facet queries" }, ],
{ "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large", "group":"Size facet queries" }, "settings": {
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large", "group":"Size facet queries" } "allowUpdateOnChange": false,
] "hideDefaultAction": true
}
} }
} }
} }
@@ -441,8 +520,8 @@ Note: `settings` property used to control UI actions and interaction. i.e
"expanded": true, "expanded": true,
"mincount": 0, "mincount": 0,
"queries": [ "queries": [
{ "query": "created:2018", "label": "Created This Year" }, { "query": "+created:2018", "label": "Created This Year" },
{ "query": "modifier:admin", "label": "Admin modifier" } { "query": "+modifier:admin", "label": "Admin modifier" }
], ],
"settings" : { "settings" : {
"allowUpdateOnChange": false, "allowUpdateOnChange": false,
@@ -467,6 +546,16 @@ The default page size of 5 will be used if you set the value to 0 or omit it ent
![Facet Queries](../docassets/images/search-facet-queries.png) ![Facet Queries](../docassets/images/search-facet-queries.png)
#### FacetQueriesSettings
| Name | Type | Default | Description |
|------|------|---------|-------------|
|allowUpdateOnChange|`boolean`|*false*|Specifies whether search should be executed automatically after FacetField value changes.|
|hideDefaultAction|`boolean`|*true*|Specifies whether default field actions should be visible.|
|facetOrder|`number`||Specifies the order of facets. Lower numbers are displayed first.|
|bucketSortBy|`string`||Specifies sort criteria of facet queries. Possible values are "LABEL" and "COUNT".|
|bucketSortDirection|`string`||Specifies sort order of facet queries. Possible values are "ASCENDING" and "DESCENDING".|
### Facet Intervals ### Facet Intervals
These provide custom categories based on admin defined ranges inside `intervals`. These provide custom categories based on admin defined ranges inside `intervals`.
@@ -481,7 +570,6 @@ use overlapping ranges if necessary.
| expanded | boolean | Toggles expanded state of the facet intervals. | | expanded | boolean | Toggles expanded state of the facet intervals. |
Note: Interval fields setting can be controlled by passing [settings](../../lib/content-services/src/lib/search/models/facet-field.interface.ts). Note: Interval fields setting can be controlled by passing [settings](../../lib/content-services/src/lib/search/models/facet-field.interface.ts).
Note: the `sets` parameter from the Search API (which sets the intervals for all fields) Note: the `sets` parameter from the Search API (which sets the intervals for all fields)
is not yet supported. is not yet supported.
@@ -515,7 +603,6 @@ is not yet supported.
} }
``` ```
You can specify a value for the `mincount` property inside each `intervals` item to set the minimum count required for a facet interval to be displayed. By default, only the intervals that have 1 or more response entries are displayed at runtime. You can specify a value for the `mincount` property inside each `intervals` item to set the minimum count required for a facet interval to be displayed. By default, only the intervals that have 1 or more response entries are displayed at runtime.
Check the [schema.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/core/app-config/schema.json) file Check the [schema.json](https://github.com/Alfresco/alfresco-ng2-components/blob/master/lib/core/app-config/schema.json) file
for further details about the structure and properties of `intervals` that you can set inside the configuration file. for further details about the structure and properties of `intervals` that you can set inside the configuration file.
@@ -578,10 +665,12 @@ then be added in each node entry response. An example partial response is shown
} }
] ]
}, },
}
``` ```
## See also ## See also
- [Search Building](search-building.md)
- [Search Query Builder](../content-services/services/search-query-builder.service.md) - [Search Query Builder](../content-services/services/search-query-builder.service.md)
- [Search Filter Component](../content-services/components/search-filter.component.md) - [Search Filter Component](../content-services/components/search-filter.component.md)
- [Search Filter Chips Component](../content-services/components/search-filter-chips.component.md) - [Search Filter Chips Component](../content-services/components/search-filter-chips.component.md)