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 7 commits
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
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.MicrosoftOffice", "src\OrchardCore.Modules\OrchardCore.Media.Indexing.MicrosoftOffice\OrchardCore.Media.Indexing.MicrosoftOffice.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 = "Microsoft Office Media Indexing",
Description = "Provides a way to index Microsoft Office files including Word and Power Point 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 Microsoft Office files Indexing</Title>
<Description>
$(OCCMSDescription)

The media module adds Microsoft Office 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.MicrosoftOffice;

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",
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
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: 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 Office files including Word and Power Point 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.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 for various files.
</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");
}
}
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"
],
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
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
Loading