From 5fdb193230c9195b6615506ff0de7132e0f9ba12 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 17 May 2024 13:01:05 -0700 Subject: [PATCH 1/6] Fix Azure Search AI docs --- src/docs/reference/modules/AzureAISearch/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/docs/reference/modules/AzureAISearch/README.md b/src/docs/reference/modules/AzureAISearch/README.md index abd1863e230..a5cef158441 100644 --- a/src/docs/reference/modules/AzureAISearch/README.md +++ b/src/docs/reference/modules/AzureAISearch/README.md @@ -2,11 +2,11 @@ The Azure AI Search module allows you to manage Azure AI Search indices. -Before enabling the service, you'll need to configure the connection to the server. By default, you can navigate to `Configurations` >> `Settings` >> `Azure AI Search` and provide the Azure Search AI service info. +Before enabling the service, you'll need to configure the connection to the service. By default, you can navigate to `Configurations` >> `Settings` >> `Azure AI Search` and provide the Azure Search AI service info. -Alternatively, you can configure the Azure Search AI service for all your tenants from the `appsettings.json` file by adding the following +Alternatively, you can configure the Azure Search AI service for all your tenants using one of the configuration providers. For example, you can add the following to the `appsettings.json`: -``` +```json { "OrchardCore":{ "OrchardCore_AzureAISearch":{ @@ -94,9 +94,9 @@ To reset all indices: } ``` -### Rebuild Elasticsearch Index Step +### Rebuild Azure AI Search Index Step -The `Rebuild Index Step` rebuilds an Elasticsearch index. It deletes and recreates the full index content. +The `Rebuild Index Step` rebuilds an Azure AI Search index. It deletes and recreates the full index content. ```json { From 2f9a587f3860e797ecf8728159d55544a7b39573 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 17 May 2024 17:00:49 -0700 Subject: [PATCH 2/6] Fix AzureAI Issues --- .../Controllers/AdminController.cs | 5 +++++ .../ContentPartFieldIndexSettingsDisplayDriver.cs | 12 +++++++----- .../ContentTypePartIndexSettingsDisplayDriver.cs | 12 +++++++----- .../Models/AzureAISearchIndexSettings.cs | 3 --- .../Recipes/AzureAISearchIndexSettingsStep.cs | 13 +++++++++---- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Controllers/AdminController.cs index f32a1c1db43..919966eebeb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Controllers/AdminController.cs @@ -351,6 +351,11 @@ public async Task EditPost(AzureAISettingsViewModel model) settings.IndexedContentTypes = model.IndexedContentTypes; settings.Culture = model.Culture ?? string.Empty; + if (string.IsNullOrEmpty(settings.IndexFullName)) + { + settings.IndexFullName = _indexManager.GetFullIndexName(settings.IndexName); + } + if (string.IsNullOrEmpty(settings.AnalyzerName)) { settings.AnalyzerName = AzureAISearchDefaultOptions.DefaultAnalyzer; diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentPartFieldIndexSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentPartFieldIndexSettingsDisplayDriver.cs index 789c2773c1f..787ddc67db0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentPartFieldIndexSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentPartFieldIndexSettingsDisplayDriver.cs @@ -22,8 +22,10 @@ public override async Task EditAsync(ContentPartFieldDefinition return null; } - return Initialize("AzureAISearchContentIndexSettings_Edit", model => contentPartFieldDefinition.GetSettings()) - .Location("Content:10"); + return Initialize("AzureAISearchContentIndexSettings_Edit", model => + { + model.Included = contentPartFieldDefinition.GetSettings().Included; + }).Location("Content:10"); } public override async Task UpdateAsync(ContentPartFieldDefinition contentPartFieldDefinition, UpdatePartFieldEditorContext context) @@ -33,11 +35,11 @@ public override async Task UpdateAsync(ContentPartFieldDefinitio return null; } - var model = new AzureAISearchContentIndexSettings(); + var settings = new AzureAISearchContentIndexSettings(); - await context.Updater.TryUpdateModelAsync(model, Prefix); + await context.Updater.TryUpdateModelAsync(settings, Prefix); - context.Builder.WithSettings(model); + context.Builder.WithSettings(settings); return await EditAsync(contentPartFieldDefinition, context.Updater); } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentTypePartIndexSettingsDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentTypePartIndexSettingsDisplayDriver.cs index 774a97df642..9b0c8376747 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentTypePartIndexSettingsDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Drivers/ContentTypePartIndexSettingsDisplayDriver.cs @@ -22,8 +22,10 @@ public override async Task EditAsync(ContentTypePartDefinition c return null; } - return Initialize("AzureAISearchContentIndexSettings_Edit", model => contentTypePartDefinition.GetSettings()) - .Location("Content:10"); + return Initialize("AzureAISearchContentIndexSettings_Edit", model => + { + model.Included = contentTypePartDefinition.GetSettings().Included; + }).Location("Content:10"); } public override async Task UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context) @@ -33,11 +35,11 @@ public override async Task UpdateAsync(ContentTypePartDefinition return null; } - var model = new AzureAISearchContentIndexSettings(); + var settings = new AzureAISearchContentIndexSettings(); - await context.Updater.TryUpdateModelAsync(model, Prefix); + await context.Updater.TryUpdateModelAsync(settings, Prefix); - context.Builder.WithSettings(model); + context.Builder.WithSettings(settings); return await EditAsync(contentTypePartDefinition, context.Updater); } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Models/AzureAISearchIndexSettings.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Models/AzureAISearchIndexSettings.cs index fcfa680a7aa..419c8133297 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Models/AzureAISearchIndexSettings.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Models/AzureAISearchIndexSettings.cs @@ -1,15 +1,12 @@ using System.Collections.Generic; using System.Linq; -using System.Text.Json.Serialization; namespace OrchardCore.Search.AzureAI.Models; public class AzureAISearchIndexSettings { - [JsonIgnore] public string IndexName { get; set; } - [JsonIgnore] public string IndexFullName { get; set; } public string AnalyzerName { get; set; } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs index 13d481feea6..e1bc50e7eb6 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; @@ -15,7 +16,7 @@ namespace OrchardCore.Search.AzureAI.Recipes; public class AzureAISearchIndexSettingsStep : IRecipeStepHandler { - public const string Name = "azureai-index-create"; + public const string Name = "AzureAISearchIndexSettings"; private readonly AzureAISearchIndexManager _indexManager; private readonly AzureAIIndexDocumentManager _azureAIIndexDocumentManager; @@ -50,11 +51,15 @@ public async Task ExecuteAsync(RecipeExecutionContext context) foreach (var index in indexes) { - var indexSettings = index.ToObject(); + var settings = index.ToObject>().FirstOrDefault(); + + var indexSettings = settings.Value; + + indexSettings.IndexName = settings.Key; if (!AzureAISearchIndexNamingHelper.TryGetSafeIndexName(indexSettings.IndexName, out var indexName)) { - _logger.LogError("Invalid index name was provided in the recipe step. IndexName: {indexName}.", indexSettings.IndexName); + _logger.LogError("Invalid index name was provided in the recipe step. IndexName: {IndexName}.", indexSettings.IndexName); continue; } @@ -75,7 +80,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) if (indexSettings.IndexedContentTypes == null || indexSettings.IndexedContentTypes.Length == 0) { - _logger.LogError("No {fieldName} were provided in the recipe step. IndexName: {indexName}.", nameof(indexSettings.IndexedContentTypes), indexSettings.IndexName); + _logger.LogError("No {FieldName} were provided in the recipe step. IndexName: {IndexName}.", nameof(indexSettings.IndexedContentTypes), indexSettings.IndexName); continue; } From 49917e831aa7ce2e1d067c454136380c19131505 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 17 May 2024 17:23:35 -0700 Subject: [PATCH 3/6] fix deployment name --- .../Deployment/AzureAISearchSettingsDeploymentStep.cs | 4 ++-- .../Recipes/AzureAISearchIndexSettingsStep.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs index fd72e12b3e9..aaa9fa6f342 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs @@ -1,5 +1,5 @@ using OrchardCore.Deployment; -using OrchardCore.Search.AzureAI.Models; +using OrchardCore.Search.AzureAI.Recipes; namespace OrchardCore.Search.AzureAI.Deployment; @@ -7,6 +7,6 @@ public class AzureAISearchSettingsDeploymentStep : DeploymentStep { public AzureAISearchSettingsDeploymentStep() { - Name = nameof(AzureAISearchSettings); + Name = AzureAISearchIndexSettingsStep.Name; } } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs index e1bc50e7eb6..ffacd7ddefb 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs @@ -16,7 +16,7 @@ namespace OrchardCore.Search.AzureAI.Recipes; public class AzureAISearchIndexSettingsStep : IRecipeStepHandler { - public const string Name = "AzureAISearchIndexSettings"; + public const string Name = "azureai-index-create"; private readonly AzureAISearchIndexManager _indexManager; private readonly AzureAIIndexDocumentManager _azureAIIndexDocumentManager; From 7521eea125739ab7de9457312487a0cb398ca3f9 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Sat, 18 May 2024 11:07:40 -0700 Subject: [PATCH 4/6] Fixhe deployemnt and recipe steps --- .../AzureAISearchIndexDeploymentSource.cs | 48 +++++++++++++----- .../AzureAISearchIndexDeploymentStep.cs | 3 +- .../AzureAISearchSettingsDeploymentStep.cs | 4 +- .../Recipes/AzureAISearchIndexSettingsStep.cs | 49 +++++++++++-------- 4 files changed, 70 insertions(+), 34 deletions(-) diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs index 0882725715b..261a63e968e 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; @@ -14,7 +13,7 @@ public class AzureAISearchIndexDeploymentSource(AzureAISearchIndexSettingsServic public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result) { - if (step is not AzureAISearchIndexDeploymentStep settingsStep) + if (step is not AzureAISearchIndexDeploymentStep indexStep) { return; } @@ -22,25 +21,52 @@ public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlan var indexSettings = await _indexSettingsService.GetSettingsAsync(); var data = new JsonArray(); - var indicesToAdd = settingsStep.IncludeAll ? indexSettings.Select(x => x.IndexName).ToArray() : settingsStep.IndexNames; + var indicesToAdd = indexStep.IncludeAll + ? indexSettings.Select(x => x.IndexName).ToArray() + : indexStep.IndexNames; foreach (var index in indexSettings) { - if (indicesToAdd.Contains(index.IndexName)) + if (index.IndexName == null || !indicesToAdd.Contains(index.IndexName)) { - var indexSettingsDict = new Dictionary - { - { index.IndexName, index }, - }; - - data.Add(JObject.FromObject(indexSettingsDict)); + continue; } + + var indexInfo = GetIndexInfo(index); + + data.Add(JObject.FromObject(indexInfo)); } result.Steps.Add(new JsonObject { - ["name"] = nameof(AzureAISearchIndexSettings), + ["name"] = step.Name, ["Indices"] = data, }); } + + private static AzureAISearchIndexInfo GetIndexInfo(AzureAISearchIndexSettings settings) + => new() + { + IndexName = settings.IndexName, + AnalyzerName = settings.AnalyzerName, + QueryAnalyzerName = settings.QueryAnalyzerName, + IndexedContentTypes = settings.IndexedContentTypes ?? [], + IndexLatest = settings.IndexLatest, + Culture = settings.Culture, + }; +} + +public class AzureAISearchIndexInfo +{ + public string IndexName { get; set; } + + public string AnalyzerName { get; set; } + + public string QueryAnalyzerName { get; set; } + + public bool IndexLatest { get; set; } + + public string[] IndexedContentTypes { get; set; } + + public string Culture { get; set; } } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentStep.cs index 0f03364f129..d9d75194689 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentStep.cs @@ -1,4 +1,5 @@ using OrchardCore.Deployment; +using OrchardCore.Search.AzureAI.Recipes; namespace OrchardCore.Search.AzureAI.Deployment; @@ -6,7 +7,7 @@ public class AzureAISearchIndexDeploymentStep : DeploymentStep { public AzureAISearchIndexDeploymentStep() { - Name = "AzureAISearchIndexSettings"; + Name = AzureAISearchIndexSettingsStep.Name; } public bool IncludeAll { get; set; } = true; diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs index aaa9fa6f342..fd72e12b3e9 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchSettingsDeploymentStep.cs @@ -1,5 +1,5 @@ using OrchardCore.Deployment; -using OrchardCore.Search.AzureAI.Recipes; +using OrchardCore.Search.AzureAI.Models; namespace OrchardCore.Search.AzureAI.Deployment; @@ -7,6 +7,6 @@ public class AzureAISearchSettingsDeploymentStep : DeploymentStep { public AzureAISearchSettingsDeploymentStep() { - Name = AzureAISearchIndexSettingsStep.Name; + Name = nameof(AzureAISearchSettings); } } diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs index ffacd7ddefb..04fbdda8e5f 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; @@ -47,27 +46,45 @@ public async Task ExecuteAsync(RecipeExecutionContext context) return; } - var indexNames = new List(); + var newIndexNames = new List(); foreach (var index in indexes) { - var settings = index.ToObject>().FirstOrDefault(); + var indexInfo = index.ToObject(); - var indexSettings = settings.Value; + if (string.IsNullOrWhiteSpace(indexInfo.IndexName)) + { + _logger.LogError("No index name was provided in the '{Name}' recipe step.", Name); - indexSettings.IndexName = settings.Key; + continue; + } - if (!AzureAISearchIndexNamingHelper.TryGetSafeIndexName(indexSettings.IndexName, out var indexName)) + if (!AzureAISearchIndexNamingHelper.TryGetSafeIndexName(indexInfo.IndexName, out var indexName)) { - _logger.LogError("Invalid index name was provided in the recipe step. IndexName: {IndexName}.", indexSettings.IndexName); + _logger.LogError("Invalid index name was provided in the recipe step. IndexName: {IndexName}.", indexInfo.IndexName); continue; } - indexSettings.IndexName = indexName; + if (indexInfo.IndexedContentTypes?.Length == 0) + { + _logger.LogError("No {IndexedContentTypes} were provided in the recipe step. IndexName: {IndexName}.", nameof(indexInfo.IndexedContentTypes), indexInfo.IndexName); + + continue; + } - if (!await _indexManager.ExistsAsync(indexSettings.IndexName)) + if (!await _indexManager.ExistsAsync(indexInfo.IndexName)) { + var indexSettings = new AzureAISearchIndexSettings() + { + IndexName = indexInfo.IndexName, + AnalyzerName = indexInfo.AnalyzerName, + QueryAnalyzerName = indexInfo.QueryAnalyzerName, + IndexedContentTypes = indexInfo.IndexedContentTypes, + IndexLatest = indexInfo.IndexLatest, + Culture = indexInfo.Culture, + }; + if (string.IsNullOrWhiteSpace(indexSettings.AnalyzerName)) { indexSettings.AnalyzerName = AzureAISearchDefaultOptions.DefaultAnalyzer; @@ -75,17 +92,9 @@ public async Task ExecuteAsync(RecipeExecutionContext context) if (string.IsNullOrEmpty(indexSettings.QueryAnalyzerName)) { - indexSettings.QueryAnalyzerName = indexSettings.AnalyzerName; - } - - if (indexSettings.IndexedContentTypes == null || indexSettings.IndexedContentTypes.Length == 0) - { - _logger.LogError("No {FieldName} were provided in the recipe step. IndexName: {IndexName}.", nameof(indexSettings.IndexedContentTypes), indexSettings.IndexName); - - continue; + indexSettings.QueryAnalyzerName = AzureAISearchDefaultOptions.DefaultAnalyzer; } - indexSettings.SetLastTaskId(0); indexSettings.IndexMappings = await _azureAIIndexDocumentManager.GetMappingsAsync(indexSettings.IndexedContentTypes); indexSettings.IndexFullName = _indexManager.GetFullIndexName(indexSettings.IndexName); @@ -93,7 +102,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) { await _azureAISearchIndexSettingsService.UpdateAsync(indexSettings); - indexNames.Add(indexSettings.IndexName); + newIndexNames.Add(indexSettings.IndexName); } } } @@ -102,7 +111,7 @@ await HttpBackgroundJob.ExecuteAfterEndOfRequestAsync(AzureAISearchIndexRebuildD { var searchIndexingService = scope.ServiceProvider.GetService(); - await searchIndexingService.ProcessContentItemsAsync(indexNames.ToArray()); + await searchIndexingService.ProcessContentItemsAsync(newIndexNames.ToArray()); }); } } From eb184654b7e2c714a3da953f26eab447ddf53ebb Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Sat, 18 May 2024 11:10:20 -0700 Subject: [PATCH 5/6] split --- .../AzureAISearchIndexDeploymentSource.cs | 16 +--------------- .../Deployment/Models/AzureAISearchIndexInfo.cs | 16 ++++++++++++++++ .../Recipes/AzureAISearchIndexSettingsStep.cs | 1 + 3 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/Models/AzureAISearchIndexInfo.cs diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs index 261a63e968e..cd17923e0df 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/AzureAISearchIndexDeploymentSource.cs @@ -2,6 +2,7 @@ using System.Text.Json.Nodes; using System.Threading.Tasks; using OrchardCore.Deployment; +using OrchardCore.Search.AzureAI.Deployment.Models; using OrchardCore.Search.AzureAI.Models; using OrchardCore.Search.AzureAI.Services; @@ -55,18 +56,3 @@ private static AzureAISearchIndexInfo GetIndexInfo(AzureAISearchIndexSettings se Culture = settings.Culture, }; } - -public class AzureAISearchIndexInfo -{ - public string IndexName { get; set; } - - public string AnalyzerName { get; set; } - - public string QueryAnalyzerName { get; set; } - - public bool IndexLatest { get; set; } - - public string[] IndexedContentTypes { get; set; } - - public string Culture { get; set; } -} diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/Models/AzureAISearchIndexInfo.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/Models/AzureAISearchIndexInfo.cs new file mode 100644 index 00000000000..6f92175c751 --- /dev/null +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Deployment/Models/AzureAISearchIndexInfo.cs @@ -0,0 +1,16 @@ +namespace OrchardCore.Search.AzureAI.Deployment.Models; + +public class AzureAISearchIndexInfo +{ + public string IndexName { get; set; } + + public string AnalyzerName { get; set; } + + public string QueryAnalyzerName { get; set; } + + public bool IndexLatest { get; set; } + + public string[] IndexedContentTypes { get; set; } + + public string Culture { get; set; } +} diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs index 04fbdda8e5f..30f4993ee53 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs @@ -8,6 +8,7 @@ using OrchardCore.Recipes.Models; using OrchardCore.Recipes.Services; using OrchardCore.Search.AzureAI.Deployment; +using OrchardCore.Search.AzureAI.Deployment.Models; using OrchardCore.Search.AzureAI.Models; using OrchardCore.Search.AzureAI.Services; From 454ab20402a13001217272c65b39362c9d529311 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Sat, 18 May 2024 11:12:47 -0700 Subject: [PATCH 6/6] one more --- .../Recipes/AzureAISearchIndexSettingsStep.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs index 30f4993ee53..1a972409f7c 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Recipes/AzureAISearchIndexSettingsStep.cs @@ -93,7 +93,7 @@ public async Task ExecuteAsync(RecipeExecutionContext context) if (string.IsNullOrEmpty(indexSettings.QueryAnalyzerName)) { - indexSettings.QueryAnalyzerName = AzureAISearchDefaultOptions.DefaultAnalyzer; + indexSettings.QueryAnalyzerName = indexSettings.AnalyzerName; } indexSettings.IndexMappings = await _azureAIIndexDocumentManager.GetMappingsAsync(indexSettings.IndexedContentTypes);