Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Media Indexing into a new module to simplify dependencies. #14989

Merged
merged 9 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions OrchardCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Search.AzureAI"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Search.AzureAI.Core", "src\OrchardCore\OrchardCore.Search.AzureAI.Core\OrchardCore.Search.AzureAI.Core.csproj", "{E9428DE8-5D81-4359-BF84-31435041FF1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Media.Indexing", "src\OrchardCore.Modules\OrchardCore.Media.Indexing\OrchardCore.Media.Indexing.csproj", "{D6E18FC6-9AE9-414D-9A85-BBE6193A6959}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1347,6 +1349,10 @@ Global
{E9428DE8-5D81-4359-BF84-31435041FF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9428DE8-5D81-4359-BF84-31435041FF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9428DE8-5D81-4359-BF84-31435041FF1A}.Release|Any CPU.Build.0 = Release|Any CPU
{D6E18FC6-9AE9-414D-9A85-BBE6193A6959}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6E18FC6-9AE9-414D-9A85-BBE6193A6959}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6E18FC6-9AE9-414D-9A85-BBE6193A6959}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6E18FC6-9AE9-414D-9A85-BBE6193A6959}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1580,6 +1586,7 @@ Global
{20356393-B16D-466C-8203-877A534E287D} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{5527BACF-FA5D-4617-978B-7EDE8942E6F6} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{E9428DE8-5D81-4359-BF84-31435041FF1A} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{D6E18FC6-9AE9-414D-9A85-BBE6193A6959} = {90030E85-0C4F-456F-B879-443E8A3F220D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46A1D25A-78D1-4476-9CBF-25B75E296341}
Expand Down
53 changes: 53 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Media.Indexing/Manifest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "Media Indexing",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion
)]

[assembly: Feature(
Id = "OrchardCore.Media.Indexing",
Name = "Media Indexing",
Description = "Provides a way to index media files with common format in search providers.",
Dependencies =
[
"OrchardCore.Media"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
Category = "Search",
EnabledByDependencyOnly = true
)]

[assembly: Feature(
Id = "OrchardCore.Media.Indexing.MicrosoftOffice",
Name = "Microsoft Office Media Indexing",
Description = "Provides a way to index Microsoft Word and Power Point files in search providers.",
hishamco marked this conversation as resolved.
Show resolved Hide resolved
Dependencies =
[
"OrchardCore.Media.Indexing"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
Category = "Search"
)]

[assembly: Feature(
Id = "OrchardCore.Media.Indexing.Pdf",
Name = "PDF Media Indexing",
Description = "Provides a way to index PDF files in search providers.",
Dependencies =
[
"OrchardCore.Media.Indexing"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
Category = "Search"
)]

[assembly: Feature(
Id = "OrchardCore.Media.Indexing.Text",
Name = "Text Media Indexing",
Description = "Provides a way to index common text files like (.txt and .md) in search providers.",
Dependencies =
[
"OrchardCore.Media.Indexing"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
Category = "Search"
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<!-- NuGet properties-->
<Title>OrchardCore Media Indexing</Title>
<Description>
$(OCCMSDescription)

The media module adds media indexing support.
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
</Description>
<PackageTags>$(PackageTags) OrchardCoreCMS ContentManagement</PackageTags>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Indexing.Abstractions\OrchardCore.Indexing.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Media.Abstractions\OrchardCore.Media.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Media.Core\OrchardCore.Media.Core.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Module.Targets\OrchardCore.Module.Targets.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.ResourceManagement\OrchardCore.ResourceManagement.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" />
<PackageReference Include="PdfPig" />
</ItemGroup>
</Project>
42 changes: 42 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Media.Indexing/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Indexing;
using OrchardCore.Modules;

namespace OrchardCore.Media.Indexing;

public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IContentFieldIndexHandler, MediaFieldIndexHandler>();
}
}

[Feature("OrchardCore.Media.Indexing.Pdf")]
public class PdfStartup : StartupBase
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<PdfMediaFileTextProvider>(".pdf");
}
}

[Feature("OrchardCore.Media.Indexing.Text")]
public class TextStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<TextMediaFileTextProvider>(".txt");
services.AddMediaFileTextProvider<TextMediaFileTextProvider>(".md");
}
}

[Feature("OrchardCore.Media.Indexing.MicrosoftOffice")]
public class MicrosoftOfficeStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<WordDocumentMediaFileTextProvider>(".docx");
services.AddMediaFileTextProvider<PresentationDocumentMediaFileTextProvider>(".pptx");
}
}
30 changes: 11 additions & 19 deletions src/OrchardCore.Modules/OrchardCore.Media/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,31 @@
Id = "OrchardCore.Media",
Name = "Media",
Description = "The media module adds media management support.",
Dependencies = new[] { "OrchardCore.ContentTypes" },
Dependencies =
[
"OrchardCore.ContentTypes"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
Category = "Content Management"
)]

[assembly: Feature(
Id = "OrchardCore.Media.Cache",
Name = "Media Cache",
Description = "The media cache module adds remote file store cache support.",
Dependencies = new[]
{
Dependencies =
[
"OrchardCore.Media"
},
],
Category = "Content Management"
)]

[assembly: Feature(
Id = "OrchardCore.Media.Slugify",
Name = "Media Slugify",
Description = "The media slugify module slugifies new folders and files to make them SEO-friendly.",
Dependencies = new[]
{
Description = "The media slugify module transforms newly created folders and files into SEO-friendly versions by generating slugs..",
Dependencies =
[
"OrchardCore.Media"
},
],
Category = "Content Management"
)]

[assembly: Feature(
Id = "OrchardCore.Media.Indexing",
Name = "Media Indexing",
Description = "Provides a way to index media files with common format in Lucene and Elasticsearch.",
Dependencies = new[]
{
"OrchardCore.Media"
},
Category = "Search"
)]
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" />
<PackageReference Include="PdfPig" />
<PackageReference Include="Shortcodes" />
<PackageReference Include="SixLabors.ImageSharp.Web" />
<PackageReference Include="System.Linq.Async" />
Expand Down
16 changes: 0 additions & 16 deletions src/OrchardCore.Modules/OrchardCore.Media/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using OrchardCore.Environment.Shell;
using OrchardCore.FileStorage;
using OrchardCore.FileStorage.FileSystem;
using OrchardCore.Indexing;
using OrchardCore.Liquid;
using OrchardCore.Media.Controllers;
using OrchardCore.Media.Core;
Expand All @@ -33,7 +32,6 @@
using OrchardCore.Media.Fields;
using OrchardCore.Media.Filters;
using OrchardCore.Media.Handlers;
using OrchardCore.Media.Indexing;
using OrchardCore.Media.Liquid;
using OrchardCore.Media.Processing;
using OrchardCore.Media.Recipes;
Expand Down Expand Up @@ -175,8 +173,6 @@ public override void ConfigureServices(IServiceCollection services)
services.AddScoped<IContentHandler, AttachedMediaFieldContentHandler>();
services.AddScoped<IModularTenantEvents, TempDirCleanerService>();
services.AddDataMigration<Migrations>();
services.AddScoped<IContentFieldIndexHandler, MediaFieldIndexHandler>();
services.AddMediaFileTextProvider<PdfMediaFileTextProvider>(".pdf");
services.AddRecipeExecutionStep<MediaStep>();

// MIME types
Expand Down Expand Up @@ -401,18 +397,6 @@ public override void ConfigureServices(IServiceCollection services)
}
}

[Feature("OrchardCore.Media.Indexing")]
public class MediaIndexingStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<TextMediaFileTextProvider>(".txt");
services.AddMediaFileTextProvider<TextMediaFileTextProvider>(".md");
services.AddMediaFileTextProvider<WordDocumentMediaFileTextProvider>(".docx");
services.AddMediaFileTextProvider<PresentationDocumentMediaFileTextProvider>(".pptx");
}
}

[RequireFeatures("OrchardCore.Shortcodes")]
public class ShortcodesStartup : StartupBase
{
Expand Down
12 changes: 12 additions & 0 deletions src/docs/releases/1.9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

Release date: Not yet released

## Breaking Changes

## Media Indexing

Previously, `.PDF` file where auto indexed in the search providers (Elasticsearch, Lucene or Azure AI Search). Now, if you want to continue to index `.PDF` file you'll need to enable `OrchardCore.Media.Indexing.Pdf` feature.

Additionally, if you needed to enable indexing for text file with `.txt`, `.md` extensions, you'll needed `OrchardCore.Media.Indexing.Text` feature.

If you needed to enable indexing for other extensions like (`.docx`, or `.pptx`), you'll needed `OrchardCore.Media.Indexing.MicrosoftOffice` feature.

## Change Logs
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved

### Azure AI Search module

Introducing a new "Azure AI Search" module, designed to empower you in the administration of Azure AI Search indices. When enabling with the "Search" module, it facilitates frontend full-text search capabilities through Azure AI Search. For more info read the [Azure AI Search](../reference/modules/AzureAISearch/README.md) docs.