Skip to content

Commit 36ec567

Browse files
authored
Merge pull request #34 from Kentico/feat/indexing-delay
feat(indexing-delay): added support for optional customizable delay
2 parents 5125796 + 87208b8 commit 36ec567

File tree

49 files changed

+2102
-2073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2102
-2073
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ dotnet add package Kentico.Xperience.AzureSearch
3838
"CMSAzureSearch": {
3939
"SearchServiceEndPoint": "<your application url>",
4040
"SearchServiceAdminApiKey": "<your application admin key>",
41-
"SearchServiceQueryApiKey": "<your application query key>"
41+
"SearchServiceQueryApiKey": "<your application query key>",
42+
43+
// Opotionally add delay between indexing items.
44+
// This is useful if there are a lot of pages and items on your web which when crawled would increase the performance requirements.
45+
"IndexItemDelay" : 0
4246
}
4347
```
4448

-3.15 KB
Binary file not shown.
-1 Bytes
Binary file not shown.

examples/DancingGoat/appsettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"SearchServiceEnabled": true,
2323
"SearchServiceEndPoint": "",
2424
"SearchServiceAdminApiKey": "",
25-
"SearchServiceQueryApiKey": ""
25+
"SearchServiceQueryApiKey": "",
26+
"IndexItemDelay" : 0
2627
}
2728
}
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
using CMS;
2-
using CMS.Base;
3-
using CMS.Core;
4-
5-
using Kentico.Xperience.Admin.Base;
6-
using Kentico.Xperience.AzureSearch.Admin;
7-
using Kentico.Xperience.AzureSearch.Aliasing;
8-
using Kentico.Xperience.AzureSearch.Indexing;
9-
10-
using Microsoft.Extensions.DependencyInjection;
11-
using Microsoft.Extensions.Options;
12-
13-
[assembly: RegisterModule(typeof(AzureSearchAdminModule))]
14-
15-
namespace Kentico.Xperience.AzureSearch.Admin;
16-
17-
/// <summary>
18-
/// Manages administration features and integration.
19-
/// </summary>
20-
internal class AzureSearchAdminModule : AdminModule
21-
{
22-
private IAzureSearchConfigurationStorageService storageService = null!;
23-
private AzureSearchModuleInstaller installer = null!;
24-
25-
public AzureSearchAdminModule() : base(nameof(AzureSearchAdminModule)) { }
26-
27-
protected override void OnInit(ModuleInitParameters parameters)
28-
{
29-
base.OnInit(parameters);
30-
31-
var options = Service.Resolve<IOptions<AzureSearchOptions>>();
32-
33-
if (!options.Value?.SearchServiceEnabled ?? false)
34-
{
35-
return;
36-
}
37-
38-
RegisterClientModule("kentico", "xperience-integrations-azuresearch");
39-
40-
var services = parameters.Services;
41-
42-
installer = services.GetRequiredService<AzureSearchModuleInstaller>();
43-
storageService = services.GetRequiredService<IAzureSearchConfigurationStorageService>();
44-
45-
ApplicationEvents.Initialized.Execute += InitializeModule;
46-
}
47-
48-
private void InitializeModule(object? sender, EventArgs e)
49-
{
50-
installer.Install();
51-
52-
AzureSearchIndexStore.SetIndicies(storageService);
53-
AzureSearchIndexAliasStore.SetAliases(storageService);
54-
}
55-
}
1+
using CMS;
2+
using CMS.Base;
3+
using CMS.Core;
4+
5+
using Kentico.Xperience.Admin.Base;
6+
using Kentico.Xperience.AzureSearch.Admin;
7+
using Kentico.Xperience.AzureSearch.Aliasing;
8+
using Kentico.Xperience.AzureSearch.Indexing;
9+
10+
using Microsoft.Extensions.DependencyInjection;
11+
using Microsoft.Extensions.Options;
12+
13+
[assembly: RegisterModule(typeof(AzureSearchAdminModule))]
14+
15+
namespace Kentico.Xperience.AzureSearch.Admin;
16+
17+
/// <summary>
18+
/// Manages administration features and integration.
19+
/// </summary>
20+
internal class AzureSearchAdminModule : AdminModule
21+
{
22+
private IAzureSearchConfigurationStorageService storageService = null!;
23+
private AzureSearchModuleInstaller installer = null!;
24+
25+
public AzureSearchAdminModule() : base(nameof(AzureSearchAdminModule)) { }
26+
27+
protected override void OnInit(ModuleInitParameters parameters)
28+
{
29+
base.OnInit(parameters);
30+
31+
var options = Service.Resolve<IOptions<AzureSearchOptions>>();
32+
33+
if (!options.Value?.SearchServiceEnabled ?? false)
34+
{
35+
return;
36+
}
37+
38+
RegisterClientModule("kentico", "xperience-integrations-azuresearch");
39+
40+
var services = parameters.Services;
41+
42+
installer = services.GetRequiredService<AzureSearchModuleInstaller>();
43+
storageService = services.GetRequiredService<IAzureSearchConfigurationStorageService>();
44+
45+
ApplicationEvents.Initialized.Execute += InitializeModule;
46+
}
47+
48+
private void InitializeModule(object? sender, EventArgs e)
49+
{
50+
installer.Install();
51+
52+
AzureSearchIndexStore.SetIndicies(storageService);
53+
AzureSearchIndexAliasStore.SetAliases(storageService);
54+
}
55+
}
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
using System.Text.Json.Serialization;
2-
3-
namespace Kentico.Xperience.AzureSearch.Admin;
4-
5-
public class AzureSearchIndexIncludedPath
6-
{
7-
/// <summary>
8-
/// The node alias pattern that will be used to match pages in the content tree for indexing.
9-
/// </summary>
10-
/// <remarks>For example, "/Blogs/Products/" will index all pages under the "Products" page.</remarks>
11-
public string AliasPath { get; }
12-
13-
/// <summary>
14-
/// A list of content types under the specified <see cref="AliasPath"/> that will be indexed.
15-
/// </summary>
16-
public List<AzureSearchIndexContentType> ContentTypes { get; set; } = [];
17-
18-
/// <summary>
19-
/// The internal identifier of the included path.
20-
/// </summary>
21-
public string? Identifier { get; set; }
22-
23-
[JsonConstructor]
24-
public AzureSearchIndexIncludedPath(string aliasPath) => AliasPath = aliasPath;
25-
26-
/// <summary>
27-
///
28-
/// </summary>
29-
/// <param name="indexPath"></param>
30-
/// <param name="contentTypes"></param>
31-
public AzureSearchIndexIncludedPath(AzureSearchIncludedPathItemInfo indexPath, IEnumerable<AzureSearchIndexContentType> contentTypes)
32-
{
33-
AliasPath = indexPath.AzureSearchIncludedPathItemAliasPath;
34-
ContentTypes = contentTypes.ToList();
35-
Identifier = indexPath.AzureSearchIncludedPathItemId.ToString();
36-
}
37-
}
1+
using System.Text.Json.Serialization;
2+
3+
namespace Kentico.Xperience.AzureSearch.Admin;
4+
5+
public class AzureSearchIndexIncludedPath
6+
{
7+
/// <summary>
8+
/// The node alias pattern that will be used to match pages in the content tree for indexing.
9+
/// </summary>
10+
/// <remarks>For example, "/Blogs/Products/" will index all pages under the "Products" page.</remarks>
11+
public string AliasPath { get; }
12+
13+
/// <summary>
14+
/// A list of content types under the specified <see cref="AliasPath"/> that will be indexed.
15+
/// </summary>
16+
public List<AzureSearchIndexContentType> ContentTypes { get; set; } = [];
17+
18+
/// <summary>
19+
/// The internal identifier of the included path.
20+
/// </summary>
21+
public string? Identifier { get; set; }
22+
23+
[JsonConstructor]
24+
public AzureSearchIndexIncludedPath(string aliasPath) => AliasPath = aliasPath;
25+
26+
/// <summary>
27+
///
28+
/// </summary>
29+
/// <param name="indexPath"></param>
30+
/// <param name="contentTypes"></param>
31+
public AzureSearchIndexIncludedPath(AzureSearchIncludedPathItemInfo indexPath, IEnumerable<AzureSearchIndexContentType> contentTypes)
32+
{
33+
AliasPath = indexPath.AzureSearchIncludedPathItemAliasPath;
34+
ContentTypes = contentTypes.ToList();
35+
Identifier = indexPath.AzureSearchIncludedPathItemId.ToString();
36+
}
37+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
namespace Kentico.Xperience.AzureSearch.Admin;
2-
3-
internal static class AzureSearchIndexPermissions
4-
{
5-
public const string REBUILD = "Rebuild";
6-
}
1+
namespace Kentico.Xperience.AzureSearch.Admin;
2+
3+
internal static class AzureSearchIndexPermissions
4+
{
5+
public const string REBUILD = "Rebuild";
6+
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
namespace Kentico.Xperience.AzureSearch.Admin;
2-
3-
public class AzureSearchIndexStatisticsViewModel
4-
{
5-
//
6-
// Summary:
7-
// Index name.
8-
public string? Name { get; set; }
9-
10-
//
11-
// Summary:
12-
// Number of records contained in the index
13-
public long Entries { get; set; }
14-
}
1+
namespace Kentico.Xperience.AzureSearch.Admin;
2+
3+
public class AzureSearchIndexStatisticsViewModel
4+
{
5+
//
6+
// Summary:
7+
// Index name.
8+
public string? Name { get; set; }
9+
10+
//
11+
// Summary:
12+
// Number of records contained in the index
13+
public long Entries { get; set; }
14+
}

0 commit comments

Comments
 (0)