-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elasticsearch feature ✨💥 (Lombiq Technologies: OSOE-83) (#11052)
- Loading branch information
Showing
333 changed files
with
7,653 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/OrchardCore.Modules/OrchardCore.ContentFields/Fields/TextField.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/OrchardCore.Modules/OrchardCore.ContentTypes/Recipes/LuceneRecipeEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json.Linq; | ||
using OrchardCore.ContentManagement.Metadata.Records; | ||
using OrchardCore.Recipes.Events; | ||
using OrchardCore.Recipes.Models; | ||
|
||
namespace OrchardCore.ContentTypes | ||
{ | ||
/// <summary> | ||
/// This handler provides backward compatibility with ContentIndexSettings that have been migrated to LuceneContentIndexSettings. | ||
/// </summary> | ||
public class LuceneRecipeEventHandler : IRecipeEventHandler | ||
{ | ||
public RecipeExecutionContext Context { get; private set; } | ||
|
||
public Task RecipeStepExecutedAsync(RecipeExecutionContext context) => Task.CompletedTask; | ||
|
||
public Task ExecutionFailedAsync(string executionId, RecipeDescriptor descriptor) => Task.CompletedTask; | ||
|
||
public Task RecipeExecutedAsync(string executionId, RecipeDescriptor descriptor) => Task.CompletedTask; | ||
|
||
public Task RecipeExecutingAsync(string executionId, RecipeDescriptor descriptor) => Task.CompletedTask; | ||
|
||
public Task RecipeStepExecutingAsync(RecipeExecutionContext context) | ||
{ | ||
if (context.Name == "ReplaceContentDefinition" || context.Name == "ContentDefinition") | ||
{ | ||
var step = context.Step.ToObject<ContentDefinitionStepModel>(); | ||
|
||
foreach (var contentType in step.ContentTypes) | ||
{ | ||
foreach (var partDefinition in contentType.ContentTypePartDefinitionRecords) | ||
{ | ||
if (partDefinition.Settings != null) | ||
{ | ||
if (partDefinition.Settings.TryGetValue("ContentIndexSettings", out var existingPartSettings) && | ||
!partDefinition.Settings.ContainsKey("LuceneContentIndexSettings")) | ||
{ | ||
partDefinition.Settings.Add(new JProperty("LuceneContentIndexSettings", existingPartSettings)); | ||
} | ||
|
||
partDefinition.Settings.Remove("ContentIndexSettings"); | ||
} | ||
} | ||
} | ||
|
||
foreach (var partDefinition in step.ContentParts) | ||
{ | ||
if (partDefinition.Settings != null) | ||
{ | ||
if (partDefinition.Settings.TryGetValue("ContentIndexSettings", out var existingPartSettings) && | ||
!partDefinition.Settings.ContainsKey("LuceneContentIndexSettings")) | ||
{ | ||
partDefinition.Settings.Add(new JProperty("LuceneContentIndexSettings", existingPartSettings)); | ||
} | ||
|
||
partDefinition.Settings.Remove("ContentIndexSettings"); | ||
|
||
foreach (var fieldDefinition in partDefinition.ContentPartFieldDefinitionRecords) | ||
{ | ||
if (fieldDefinition.Settings != null) | ||
{ | ||
if (fieldDefinition.Settings.TryGetValue("ContentIndexSettings", out var existingFieldSettings) && | ||
!fieldDefinition.Settings.ContainsKey("LuceneContentIndexSettings")) | ||
{ | ||
fieldDefinition.Settings.Add(new JProperty("LuceneContentIndexSettings", existingFieldSettings)); | ||
} | ||
|
||
fieldDefinition.Settings.Remove("ContentIndexSettings"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
context.Step = JObject.FromObject(step); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private class ContentDefinitionStepModel | ||
{ | ||
public string Name { get; set; } | ||
public ContentTypeDefinitionRecord[] ContentTypes { get; set; } = Array.Empty<ContentTypeDefinitionRecord>(); | ||
public ContentPartDefinitionRecord[] ContentParts { get; set; } = Array.Empty<ContentPartDefinitionRecord>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.