mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-6644] Updated config guide, added build example, fixed mistakes (#9700)
This commit is contained in:
parent
6c740bc35c
commit
376969ae42
@ -2,12 +2,12 @@
|
||||
Title: Search check list component
|
||||
Added: v2.4.0
|
||||
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")
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
Title: Search filter tabbed component
|
||||
Added: v6.2.0
|
||||
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")
|
||||
@ -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 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 tabbed component](search-date-range-tabbed.component.md)
|
||||
- [Search number range component](search-number-range.component.md)
|
||||
- [Search radio component](search-radio.component.md)
|
||||
- [Search slider component](search-slider.component.md)
|
||||
|
@ -2,15 +2,23 @@
|
||||
Title: Search Form component
|
||||
Added: v4.5.0
|
||||
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")
|
||||
|
||||
Implements a component consisting of a menu populated with search filter sets.
|
||||
|
||||

|
||||
|
||||
## Basic usage
|
||||
|
||||
### In .html files
|
||||
```html
|
||||
<adf-search-form></adf-search-form>
|
||||
```
|
||||
|
||||
### In app config
|
||||
```json
|
||||
{
|
||||
"search": [
|
||||
@ -26,10 +34,9 @@ Last reviewed: 2021-06-11
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -49,7 +49,7 @@ user types `test`
|
||||
user types `*`
|
||||
|
||||
```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`
|
||||
|
@ -2,12 +2,12 @@
|
||||
Title: Search number range component
|
||||
Added: v2.4.0
|
||||
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")
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
Title: Search radio component
|
||||
Added: v2.4.0
|
||||
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")
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
Title: Search slider component
|
||||
Added: v2.4.0
|
||||
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")
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
|
@ -2,12 +2,12 @@
|
||||
Title: Search text component
|
||||
Added: v2.4.0
|
||||
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")
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
|
BIN
docs/docassets/images/search-with-configs-example.png
Normal file
BIN
docs/docassets/images/search-with-configs-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
BIN
docs/docassets/images/simple-search-example.png
Normal file
BIN
docs/docassets/images/simple-search-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
170
docs/user-guide/search-building.md
Normal file
170
docs/user-guide/search-building.md
Normal 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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
### 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)
|
@ -34,8 +34,10 @@ ADF support single or multiple [search configurations](https://github.com/Alfres
|
||||
{
|
||||
"search": {
|
||||
"name": "Application search",
|
||||
"query": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" }
|
||||
"default": true,
|
||||
"filteredWithContaints": true,
|
||||
"filterQueryies": [
|
||||
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
|
||||
],
|
||||
"category": []
|
||||
}
|
||||
@ -50,16 +52,19 @@ This configuration considered for searching in the application.
|
||||
{
|
||||
"search": [
|
||||
{
|
||||
"name": "Application search",
|
||||
"default": "true",
|
||||
"query": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" }
|
||||
"name": "Application default search",
|
||||
"default": true,
|
||||
"filteredWithContaints": true,
|
||||
"filterQueries": [
|
||||
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Customer payout",
|
||||
"query": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" }
|
||||
"name": "Application secondary search",
|
||||
"default": false,
|
||||
"filteredWithContaints": true,
|
||||
"filterQueries": [
|
||||
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" }
|
||||
{ "query": "-TYPE:'st:site' AND -ASPECT:'st:siteContainer' AND -ASPECT:'sys:hidden'" }
|
||||
]
|
||||
}
|
||||
@ -108,41 +113,74 @@ A typical configuration is shown below:
|
||||
```json
|
||||
{
|
||||
"search": {
|
||||
"name": "Application search",
|
||||
"default": true,
|
||||
"filterWithContains": true,
|
||||
"sorting": {
|
||||
"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": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true }
|
||||
{
|
||||
"key": "name",
|
||||
"label": "Name",
|
||||
"type": "FIELD",
|
||||
"field": "cm:name",
|
||||
"ascending": true
|
||||
},
|
||||
],
|
||||
"defaults": [
|
||||
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true }
|
||||
{
|
||||
"key": "name",
|
||||
"type": "FIELD",
|
||||
"field": "cm:name",
|
||||
"ascending": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"filterQueries": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "query": "NOT cm:creator:System" }
|
||||
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" },
|
||||
{ "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": {
|
||||
"mincount": 1,
|
||||
"label": "My facet queries",
|
||||
"pageSize": 4,
|
||||
"expanded": true,
|
||||
"queries": [
|
||||
{ "query": "created:2018", "label": "Created This Year" },
|
||||
{ "query": "content.mimetype:text/html", "label": "Type: HTML" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small"},
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small" },
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small" },
|
||||
{ "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:[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": [
|
||||
@ -150,10 +188,11 @@ A typical configuration is shown below:
|
||||
"id": "queryName",
|
||||
"name": "Name",
|
||||
"enabled": true,
|
||||
"expanded": true,
|
||||
"component": {
|
||||
"selector": "adf-search-text",
|
||||
"selector": "text",
|
||||
"settings": {
|
||||
"allowUpdateOnChange": false,
|
||||
"hideDefaultAction": true,
|
||||
"pattern": "cm:name:'(.*?)'",
|
||||
"field": "cm:name",
|
||||
"placeholder": "Enter the name"
|
||||
@ -178,7 +217,9 @@ results:
|
||||
```json
|
||||
{
|
||||
"search": {
|
||||
...
|
||||
"include": ["path", "allowableOperations"]
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -188,7 +229,9 @@ You can choose to filter facet field results using 'contains' instead of 'starts
|
||||
```json
|
||||
{
|
||||
"search": {
|
||||
...
|
||||
"filterWithContains": true
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -199,7 +242,9 @@ This 'clean up' button would make it easier for the final user to remove all buc
|
||||
```json
|
||||
{
|
||||
"search": {
|
||||
...
|
||||
"resetButton": true
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -210,10 +255,12 @@ settings:
|
||||
```json
|
||||
{
|
||||
"search": {
|
||||
...
|
||||
"filterQueries": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "query": "NOT cm:creator:System" }
|
||||
{ "query": "+TYPE:'cm:folder' OR +TYPE:'cm:content'" },
|
||||
{ "query": "-cm:creator:System" }
|
||||
]
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -248,15 +295,13 @@ The properties of the `options` objects are as follows:
|
||||
|
||||
| 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. |
|
||||
| label | string | Display text, which can also be an [i18n resource key](../../user-guide/internationalization.md). |
|
||||
| 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). |
|
||||
| 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. |
|
||||
| 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)
|
||||
element in the [ACS Search API](https://docs.alfresco.com/5.2/concepts/search-api.html)
|
||||
for further details.
|
||||
See the information on sorting in the [Search API](../../lib/js-api/src/api/search-rest-api/docs/SearchApi.md) for further details.
|
||||
|
||||
### 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 |
|
||||
|----------------------------------------------------------------------------------------------| -------- |------------------------------------------------------------------------------|
|
||||
| [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 |
|
||||
| [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 |
|
||||
| [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": {
|
||||
"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" },
|
||||
{ "field": "created", "mincount": 1, "label": "Created" }
|
||||
{
|
||||
"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
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -370,6 +433,17 @@ Note: Facet Fields setting can be controlled by passing [settings](../../lib/con
|
||||
| limit | number | | Maximum number of results |
|
||||
| pageSize | number | 5 | Display page size |
|
||||
| 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
|
||||
|
||||
@ -379,19 +453,23 @@ These provide custom categories based on admin-defined facet queries.
|
||||
{
|
||||
"search": {
|
||||
"facetQueries": {
|
||||
"label": "Facet queries",
|
||||
"pageSize": 5,
|
||||
"mincount": 1,
|
||||
"label": "My facet queries",
|
||||
"pageSize": 4,
|
||||
"expanded": true,
|
||||
"queries": [
|
||||
{ "query": "created:2018", "label": "Created This Year" },
|
||||
{ "query": "content.mimetype:text/html", "label": "Type: HTML" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small"},
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small" },
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small" },
|
||||
{ "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:[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,
|
||||
"mincount": 0,
|
||||
"queries": [
|
||||
{ "query": "created:2018", "label": "Created This Year" },
|
||||
{ "query": "modifier:admin", "label": "Admin modifier" },
|
||||
{ "query": "content.mimetype:text/html", "label": "Type: HTML", "group":"Type facet queries" },
|
||||
{ "query": "content.mimetype:image/png", "label": "Type: PNG", "group":"Type facet queries" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small", "group":"Size facet queries"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small", "group":"Size facet queries"},
|
||||
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium", "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" },
|
||||
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large", "group":"Size facet queries" }
|
||||
]
|
||||
{ "query": "content.mimetype:text/html", "label": "Type: HTML", "group": "Type facet queries" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small", "group": "Size facet queries"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small", "group": "Size facet queries"},
|
||||
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium", "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" },
|
||||
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large", "group": "Size facet queries" }
|
||||
],
|
||||
"settings": {
|
||||
"allowUpdateOnChange": false,
|
||||
"hideDefaultAction": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,8 +520,8 @@ Note: `settings` property used to control UI actions and interaction. i.e
|
||||
"expanded": true,
|
||||
"mincount": 0,
|
||||
"queries": [
|
||||
{ "query": "created:2018", "label": "Created This Year" },
|
||||
{ "query": "modifier:admin", "label": "Admin modifier" }
|
||||
{ "query": "+created:2018", "label": "Created This Year" },
|
||||
{ "query": "+modifier:admin", "label": "Admin modifier" }
|
||||
],
|
||||
"settings" : {
|
||||
"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
|
||||
|
||||

|
||||
|
||||
#### 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
|
||||
|
||||
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. |
|
||||
|
||||
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)
|
||||
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.
|
||||
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.
|
||||
@ -578,10 +665,12 @@ then be added in each node entry response. An example partial response is shown
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Search Building](search-building.md)
|
||||
- [Search Query Builder](../content-services/services/search-query-builder.service.md)
|
||||
- [Search Filter Component](../content-services/components/search-filter.component.md)
|
||||
- [Search Filter Chips Component](../content-services/components/search-filter-chips.component.md)
|
||||
|
Loading…
x
Reference in New Issue
Block a user