Skip to content

Commit b394394

Browse files
authored
Indexing descript and version history
1 parent fe5b17b commit b394394

File tree

1 file changed

+66
-1
lines changed
  • src/Umbraco.Cms.Integrations.Search.Algolia

1 file changed

+66
-1
lines changed

src/Umbraco.Cms.Integrations.Search.Algolia/readme.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This integration provides a custom dashboard for managing search indices in Algo
55
## Prerequisites
66

77
Required minimum versions of Umbraco CMS:
8-
- CMS: 10.1.0
8+
- CMS: 10.3.1
99
- Algolia.Search: 6.13.0
1010

1111
## How To Use
@@ -59,3 +59,68 @@ From the dashboard you can also perform a search over one selected index, or rem
5959
Two additional handlers for _ContentDeletedNotification_ and _ContentUnpublishedNotification_ will remove the matching object from Algolia.
6060

6161
Each Umbraco content item indexed in Algolia is referenced by the content entity's `GUID` Key field.
62+
63+
### Algolia record structure
64+
An indexed Algolia record matching an Umbraco content item is composed of a default set of properties and a list of properties defined within the Umbraco dashboard.
65+
66+
Properties that can vary by culture will have a record property corespondent with this naming convention: `[property]-[culture]`.
67+
68+
The list of default properties consists of:
69+
- `ObjectID` - `Guid` from the content item's `Key` property
70+
- `Name` - with culture variants if any
71+
- `CreateDate`
72+
- `UpdateDate`
73+
- `Url` - with culture variants if any
74+
75+
### Extending the Algolia indexing
76+
Indexing the content for Algolia is based on the `IDataEditor.PropertyIndexValueFactory` property from the CMS, the indexed value of the property being retrieved using the `GetIndexValues` method.
77+
78+
The [`ContentBuilder`](https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main/src/Umbraco.Cms.Integrations.Search.Algolia/Builders/ContentRecordBuilder.cs) is responsible for creating the record object that will be pushed to _Algolia_ and the [`AlgoliaSearchPropertyIndexValueFactory`](https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main/src/Umbraco.Cms.Integrations.Search.Algolia/Services/AlgoliaSearchPropertyIndexValueFactory.cs) implementation of `IAlgoliaSearchPropertyIndexValueFactory` will returned the property value.
79+
80+
Current implementation contains a custom converter for the `Umbraco.MediaPicker3` property editor.
81+
82+
If a different implementation is required, you will need to follow these steps:
83+
- inherit from `AlgoliaSearchPropertyIndexValueFactory`
84+
- override the `GetValue` method
85+
- add custom handlers to the [`Converters`](https://github.com/umbraco/Umbraco.Cms.Integrations/blob/fe5b17be519fff2c2420966febe73c8ed61c9374/src/Umbraco.Cms.Integrations.Search.Algolia/Services/AlgoliaSearchPropertyIndexValueFactory.cs#L26) dictionary
86+
- register your implementation in the composer
87+
88+
#### Example
89+
```
90+
public class ExtendedAlgoliaSearchPropertyIndexValueFactory : AlgoliaSearchPropertyIndexValueFactory
91+
{
92+
private readonly IMediaService _mediaService;
93+
94+
public ExtendedAlgoliaSearchPropertyIndexValueFactory(IDataTypeService dataTypeService, IMediaService mediaService)
95+
: base(dataTypeService, mediaService)
96+
{
97+
_mediaService = mediaService;
98+
99+
Converters = new Dictionary<string, Func<KeyValuePair<string, IEnumerable<object>>, string>>
100+
{
101+
{ Core.Constants.PropertyEditors.Aliases.MediaPicker3, ExtendedMediaPickerConverter }
102+
};
103+
}
104+
105+
public override KeyValuePair<string, string> GetValue(IProperty property, string culture)
106+
{
107+
return base.GetValue(property, culture);
108+
}
109+
110+
private string ExtendedMediaPickerConverter(KeyValuePair<string, IEnumerable<object>> indexValue)
111+
{
112+
return "my custom converter for media picker";
113+
}
114+
115+
}
116+
```
117+
#### Extension registration
118+
```
119+
builder.Services.AddScoped<IAlgoliaSearchPropertyIndexValueFactory, ExtendedAlgoliaSearchPropertyIndexValueFactory>();
120+
```
121+
122+
### Version history
123+
- 1.2.0 - Indexing for complex types
124+
- 1.1.1 - Folder structured content types bug fix
125+
- 1.1.0 - String arrays bug fix
126+
- 1.0.0 - Initial release

0 commit comments

Comments
 (0)