Skip to content

Commit

Permalink
Move Media Indexing into a new module to simplify dependencies. (#14989)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Jan 8, 2024
1 parent 0dab071 commit 9638cd1
Show file tree
Hide file tree
Showing 15 changed files with 182 additions and 27 deletions.
14 changes: 14 additions & 0 deletions OrchardCore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ 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.Pdf", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.Pdf\OrchardCore.Media.Indexing.Pdf.csproj", "{95187E6A-5B74-4475-8FEB-758ACD012DCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCore.Media.Indexing.OpenXML", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.OpenXML\OrchardCore.Media.Indexing.OpenXML.csproj", "{47777735-7432-4CCA-A8C5-672E9EE65121}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1347,6 +1351,14 @@ 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
{95187E6A-5B74-4475-8FEB-758ACD012DCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95187E6A-5B74-4475-8FEB-758ACD012DCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95187E6A-5B74-4475-8FEB-758ACD012DCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95187E6A-5B74-4475-8FEB-758ACD012DCC}.Release|Any CPU.Build.0 = Release|Any CPU
{47777735-7432-4CCA-A8C5-672E9EE65121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47777735-7432-4CCA-A8C5-672E9EE65121}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47777735-7432-4CCA-A8C5-672E9EE65121}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47777735-7432-4CCA-A8C5-672E9EE65121}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1580,6 +1592,8 @@ 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}
{95187E6A-5B74-4475-8FEB-758ACD012DCC} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{47777735-7432-4CCA-A8C5-672E9EE65121} = {90030E85-0C4F-456F-B879-443E8A3F220D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46A1D25A-78D1-4476-9CBF-25B75E296341}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "OpenXML Media Indexing",
Description = "Provides a way to index Office files such as Word and Power Point in search providers",
Dependencies =
[
"OrchardCore.Media.Indexing"
],
Category = "Search",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- NuGet properties-->
<Title>OrchardCore OpenXML files Indexing</Title>
<Description>
$(OCCMSDescription)

The media module adds OpenXML files indexing support.
</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.Module.Targets\OrchardCore.Module.Targets.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.ResourceManagement\OrchardCore.ResourceManagement.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Modules;

namespace OrchardCore.Media.Indexing.OpenXML;

public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<WordDocumentMediaFileTextProvider>(".docx");
services.AddMediaFileTextProvider<PresentationDocumentMediaFileTextProvider>(".pptx");
}
}
14 changes: 14 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Media.Indexing.Pdf/Manifest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "PDF Media Indexing",
Description = "Provides a way to index PDF files in search providers.",
Dependencies =
[
"OrchardCore.Media.Indexing"
],
Category = "Search",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- NuGet properties-->
<Title>OrchardCore PDF files Indexing</Title>
<Description>
$(OCCMSDescription)

The media module adds PDF files indexing support.
</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.Module.Targets\OrchardCore.Module.Targets.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.ResourceManagement\OrchardCore.ResourceManagement.csproj" />
</ItemGroup>

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

namespace OrchardCore.Media.Indexing.Pdf;

public class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddMediaFileTextProvider<PdfMediaFileTextProvider>(".pdf");
}
}
53 changes: 34 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,54 @@
Id = "OrchardCore.Media",
Name = "Media",
Description = "The media module adds media management support.",
Dependencies = new[] { "OrchardCore.ContentTypes" },
Dependencies =
[
"OrchardCore.ContentTypes"
],
Category = "Content Management"
)]

[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"
],
Category = "Search",
EnabledByDependencyOnly = true
)]

[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"
],
Category = "Search"
)]

[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
13 changes: 9 additions & 4 deletions src/OrchardCore.Modules/OrchardCore.Media/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,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 @@ -403,13 +401,20 @@ public override void ConfigureServices(IServiceCollection services)

[Feature("OrchardCore.Media.Indexing")]
public class MediaIndexingStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IContentFieldIndexHandler, MediaFieldIndexHandler>();
}
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Localization\OrchardCore.Localization.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Markdown\OrchardCore.Markdown.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media\OrchardCore.Media.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media.Azure\OrchardCore.Media.Azure.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media.AmazonS3\OrchardCore.Media.AmazonS3.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media.Azure\OrchardCore.Media.Azure.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media.Indexing.OpenXML\OrchardCore.Media.Indexing.OpenXML.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Media.Indexing.Pdf\OrchardCore.Media.Indexing.Pdf.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Microsoft.Authentication\OrchardCore.Microsoft.Authentication.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.MiniProfiler\OrchardCore.MiniProfiler.csproj" PrivateAssets="none" />
<ProjectReference Include="..\..\OrchardCore.Modules\OrchardCore.Menu\OrchardCore.Menu.csproj" PrivateAssets="none" />
Expand Down
14 changes: 13 additions & 1 deletion 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.OpenXML` feature.

## Change Logs

### 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.
Introducing a new "Azure AI Search" module, designed to empower you in the administration of Azure AI Search indices. When enabled 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.

0 comments on commit 9638cd1

Please sign in to comment.