Implements custom search providers in Orchard Core following the Elasticsearch provider pattern. Covers module structure, index contracts, profile handlers, permissions, and Search integration.
Ships in orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate code and configuration for implementing a new search provider module such as OpenSearch by following the current OrchardCore.Elasticsearch pattern.
OrchardCore.Elasticsearch, not legacy feature aliases.OrchardCore.OpenSearch, not OrchardCore.Search.OpenSearch.OrchardCore.ContentsOrchardCore.Search integration through AddSearchService<TService>()Startup and keep feature-specific registrations in separate StartupBase classes decorated with [RequireFeatures(...)].IndexProfileHandlerBase to initialize and update provider-specific metadata and mappings.DisplayDriver<IndexProfile> only when the provider exposes editable provider-specific metadata.AdminController only when the provider needs extra actions such as index info, run query, or custom diagnostics.CreateOrUpdateIndexProfile, ResetIndex, and RebuildIndex for any provider.OrchardCore.Search by adding a scoped ISearchService and keyed registration through services.AddSearchService<TService>(ProviderName).IIndexManager, IDocumentIndexManager,
and IIndexNameProvider; AddIndexingSource registers them as keyed
services by provider name.IndexingPermissions.QuerySearchIndex and the dynamic
QueryIndex_{name} permissions for index access instead of defining a
second generic query-index permission.fieldType.RequirePermission(QueryPermissions.CreatePermissionForQuery(query.Name)), as the built-in providers do since Orchard Core 4.0.Search, such as OrchardCore:Search:OpenSearch (the Orchard Core 4.0 convention, next to Search:Elasticsearch and Search:AzureAISearch). Do not use an OrchardCore_* prefixed section name. Ship a ConfigurationSchema.json in the package for appsettings.json IntelliSense if possible.IOptionsMonitor<TOptions>.CurrentValue, register services.AddSignalOptionsChangeTokenSource<TOptions>(), and call IOptionsUpdateNotifier.RequestUpdate<TOptions>() after the settings are saved (the Azure AI Search pattern).LocalizationSource.Create(description, typeof(DeclaringType)) descriptions, and imply the provider's manage permission by IndexingPermissions.ManageIndexes.[EndpointName] values per verb (for example ApiGetOpenSearchContent and ApiPostOpenSearchContent) so the OpenAPI document is valid.sealed modifier.{ "steps": [...] } format.For a provider like OpenSearch, the usual pieces are:
Manifest.cs feature definitionsOpenSearchConstants.ProviderNameAddOpenSearchServices()DisplayDriver<IndexProfile> for provider metadataIndexProfileHandlerBase implementation for mappings and query defaultsContentsStartup that registers AddOpenSearchIndexingSource(...)SearchStartup that integrates with OrchardCore.SearchFollow the current Elasticsearch feature structure, but without the obsolete compatibility feature:
using OrchardCore.Modules.Manifest;
[assembly: Module(
Name = "OpenSearch",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion
)]
[assembly: Feature(
Id = "OrchardCore.OpenSearch",
Name = "OpenSearch",
Description = "Creates OpenSearch indexes to support search scenarios.",
Dependencies =
[
"OrchardCore.Queries.Core",
"OrchardCore.Indexing",
"OrchardCore.ContentTypes",
],
Category = "Search"
)]
Add separate startup classes for optional integrations:
[RequireFeatures("OrchardCore.Contents")] for content indexing registration[RequireFeatures("OrchardCore.Search")] for ISearchServiceCreate provider-specific service extensions just like Elasticsearch does:
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Indexing.Core;
using OrchardCore.OpenSearch.Core.Services;
using OrchardCore.Queries;
namespace OrchardCore.OpenSearch;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddOpenSearchServices(this IServiceCollection services)
{
services.AddScoped<OpenSearchQueryService>();
services.AddQuerySource<OpenSearchQuerySource>(OpenSearchQuerySource.SourceName);
return services;
}
public static IServiceCollection AddOpenSearchIndexingSource(
this IServiceCollection services,
string implementationType,
Action<IndexingOptionsEntry> action = null)
{
ArgumentException.ThrowIfNullOrEmpty(implementationType);
services.AddIndexingSource<
OpenSearchIndexManager,
OpenSearchDocumentIndexManager,
OpenSearchIndexNameProvider>(
OpenSearchConstants.ProviderName,
implementationType,
action);
return services;
}
}
Register connection options, client factory, provider services, query support, permissions, navigation, and profile UI in the main startup:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using OrchardCore.Data.Migration;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Environment.Shell.Configuration;
using OrchardCore.Indexing.Models;
using OrchardCore.Modules;
using OrchardCore.Navigation;
using OrchardCore.OpenSearch.Core.Handlers;
using OrchardCore.OpenSearch.Core.Models;
using OrchardCore.OpenSearch.Core.Services;
using OrchardCore.OpenSearch.Drivers;
using OrchardCore.OpenSearch.Services;
using OrchardCore.Queries;
using OrchardCore.Queries.Core;
using OrchardCore.Security.Permissions;
namespace OrchardCore.OpenSearch;
public sealed class Startup : StartupBase
{
private readonly IShellConfiguration _shellConfiguration;
public Startup(IShellConfiguration shellConfiguration)
{
_shellConfiguration = shellConfiguration;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IConfigureOptions<OpenSearchConnectionOptions>, OpenSearchConnectionOptionsConfigurations>();
services.AddTransient<IOpenSearchClientFactory, OpenSearchClientFactory>();
services.AddSingleton(sp =>
{
var factory = sp.GetRequiredService<IOpenSearchClientFactory>();
var options = sp.GetRequiredService<IOptions<OpenSearchConnectionOptions>>().Value;
return factory.Create(options);
});
services.Configure<OpenSearchOptions>(options =>
{
// "Search:OpenSearch", nested in the OrchardCore section of the shell configuration.
var configuration = _shellConfiguration.GetSection(OpenSearchConnectionOptionsConfigurations.SectionName);
options.AddIndexPrefix(configuration);
options.AddAnalyzers(configuration);
options.AddTokenFilters(configuration);
});
services.AddOpenSearchServices();
services.AddPermissionProvider<PermissionProvider>();
services.AddNavigationProvider<AdminMenu>();
services.AddDisplayDriver<Query, OpenSearchQueryDisplayDriver>();
services.AddScoped<IQueryHandler, OpenSearchQueryHandler>();
services.AddDisplayDriver<IndexProfile, OpenSearchIndexProfileDisplayDriver>();
services.AddIndexProfileHandler<OpenSearchIndexProfileHandler>();
services.AddDataMigration<OpenSearchMigrations>();
}
}
Register the search service only when the OrchardCore.Search feature is enabled:
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Modules;
using OrchardCore.Search;
namespace OrchardCore.OpenSearch;
[RequireFeatures("OrchardCore.Search")]
public sealed class SearchStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddSearchService<OpenSearchService>(OpenSearchConstants.ProviderName);
}
}
This is the current Orchard Core pattern used by Elasticsearch, Lucene, and Azure AI Search.
using OrchardCore.Indexing.Core;
using OrchardCore.Localization;
using OrchardCore.Security.Permissions;
namespace OrchardCore.OpenSearch;
public static class OpenSearchPermissions
{
public static readonly Permission ManageOpenSearchIndexes = new(
"ManageOpenSearchIndexes",
LocalizationSource.Create("Manage OpenSearch indexes", typeof(OpenSearchPermissions)),
[IndexingPermissions.ManageIndexes]);
public static readonly Permission QueryOpenSearchApi = new(
"QueryOpenSearchApi",
LocalizationSource.Create("Query OpenSearch API", typeof(OpenSearchPermissions)),
[ManageOpenSearchIndexes]);
}
public sealed class PermissionProvider : IPermissionProvider
{
private readonly IEnumerable<Permission> _allPermissions =
[
OpenSearchPermissions.ManageOpenSearchIndexes,
OpenSearchPermissions.QueryOpenSearchApi,
];
public Task<IEnumerable<Permission>> GetPermissionsAsync()
=> Task.FromResult(_allPermissions);
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() =>
[
new PermissionStereotype
{
Name = OrchardCoreConstants.Roles.Administrator,
Permissions = _allPermissions,
},
];
}
The generic indexing authorization is centralized in
OrchardCore.Indexing.Core.IndexingPermissions. Provider-specific permissions
may still protect provider-only administration or query DSL endpoints, but a
provider must not replace the shared QuerySearchIndex and dynamic
QueryIndex_{name} permissions for normal index access.
Add a separate startup for content indexing support:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Data.Migration;
using OrchardCore.Indexing.Core;
using OrchardCore.Modules;
using OrchardCore.OpenSearch.Core.Handlers;
namespace OrchardCore.OpenSearch;
[RequireFeatures("OrchardCore.Contents")]
public sealed class ContentsStartup : StartupBase
{
internal readonly IStringLocalizer S;
public ContentsStartup(IStringLocalizer<ContentsStartup> stringLocalizer)
{
S = stringLocalizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddDataMigration<IndexingMigrations>();
services
.AddIndexProfileHandler<OpenSearchContentIndexProfileHandler>()
.AddOpenSearchIndexingSource(IndexingConstants.ContentsIndexSource, o =>
{
o.DisplayName = S["Content in OpenSearch"];
o.Description = S["Create an OpenSearch index based on site contents."];
});
}
}
Provider-specific mappings belong in an IndexProfileHandlerBase implementation:
using OpenSearch.Client;
using OrchardCore.Entities;
using OrchardCore.Indexing.Core.Handlers;
using OrchardCore.Indexing.Models;
using OrchardCore.OpenSearch.Core.Models;
namespace OrchardCore.OpenSearch.Core.Handlers;
public sealed class OpenSearchIndexProfileHandler : IndexProfileHandlerBase
{
public override Task InitializingAsync(InitializingContext<IndexProfile> context)
=> ApplyDefaultsAsync(context.Model);
public override Task CreatingAsync(CreatingContext<IndexProfile> context)
=> ApplyDefaultsAsync(context.Model);
public override Task UpdatingAsync(UpdatingContext<IndexProfile> context)
=> ApplyDefaultsAsync(context.Model);
private static Task ApplyDefaultsAsync(IndexProfile indexProfile)
{
if (!string.Equals(indexProfile.ProviderName, OpenSearchConstants.ProviderName, StringComparison.OrdinalIgnoreCase))
{
return Task.CompletedTask;
}
if (!indexProfile.TryGet<OpenSearchIndexMetadata>(out var metadata))
{
metadata = new OpenSearchIndexMetadata();
}
metadata.IndexMappings ??= new OpenSearchIndexMap();
metadata.IndexMappings.Mapping ??= new TypeMapping();
metadata.IndexMappings.Mapping.Properties ??= [];
metadata.IndexMappings.KeyFieldName = "ContentItemId";
indexProfile.Put(metadata);
if (!indexProfile.TryGet<OpenSearchDefaultQueryMetadata>(out var queryMetadata))
{
queryMetadata = new OpenSearchDefaultQueryMetadata();
}
queryMetadata.DefaultSearchFields = ["Content.ContentItem.FullText"];
indexProfile.Put(queryMetadata);
return Task.CompletedTask;
}
}
Do not add an AdminController by default.
Add one only when the provider needs provider-specific actions such as:
If the provider only needs normal index-profile editing, lifecycle operations, and search registration, the display driver and handler pattern is enough.
When you do add one, check the provider's manage permission at the start of every action, including read-only ones:
[Admin("OpenSearch/indexinfo/{id}", "OpenSearch.IndexInfo")]
public async Task<IActionResult> IndexInfo(string id)
{
if (!await _authorizationService.AuthorizeAsync(User, OpenSearchPermissions.ManageOpenSearchIndexes))
{
return Forbid();
}
var index = await _indexProfileStore.FindByIdAsync(id);
if (index is null)
{
return NotFound();
}
// ...
return View();
}
Do not add provider-specific deployment steps just to manage indexes.
Use the provider-agnostic steps that already exist:
CreateOrUpdateIndexProfileResetIndexRebuildIndex{
"steps": [
{
"name": "CreateOrUpdateIndexProfile",
"indexes": [
{
"Name": "OpenSearchContent",
"IndexName": "opensearch-content",
"ProviderName": "OpenSearch",
"Type": "Content",
"Properties": {
"ContentIndexMetadata": {
"IndexLatest": false,
"IndexedContentTypes": ["Article", "BlogPost"],
"Culture": "any"
},
"OpenSearchIndexMetadata": {
"AnalyzerName": "standard"
},
"OpenSearchDefaultQueryMetadata": {
"DefaultSearchFields": [
"Content.ContentItem.FullText"
]
}
}
}
]
}
]
}
if blocks where possible.AddOpenSearchIndexingSource() over scattered direct calls to AddIndexingSource(...).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
140 skills in this plugin
/orchardcore-adminGuidance for the Orchard Core admin panel, including admin controllers and routes, admin menu registration with AdminNavigationProvider, ocat editor forms grouped in cards, admin pages rendering Model.Editor, the UI text casing standard, TheAdmin layout and menu colors, admin branding, the Navbar shape, the Ctrl+K quick navigation palette and QuickNavigationSource, AdminSettings such as MenuBehavior, ShowBreadcrumb, DisplayQuickNavigation, DisplayTitlesInTopbar and ActionsLayout, the AdminDashboard shape, settings pages, and admin filters and zones. Use this skill when requests mention the Orchard Core admin panel, TheAdmin, admin controllers, admin menu registration, an icon on an admin menu item, the AdminSettings recipe step, quick navigation, navigation menu behavior, the admin URL prefix, UI text casing. Strong matches include OrchardCore.Admin, AdminSettings, AdminPermissions, AdminOptions, AdminAttribute, SiteDisplayDriver, IDisplayManager./orchardcore-admin-dashboardSkill for creating admin dashboard widgets in Orchard Core. Covers the DashboardWidget stereotype, DashboardPart position and sizing, the built-in HtmlDashboardWidget, ContentsMetadata and ContentsTags widget types, custom widget content types via recipe or migration, arranging widgets in Manage Dashboard mode, widget template customization, provisioning widgets with recipes, dashboard permissions, the DashboardBreadcrumbProvider Dashboard ancestor, and the AdminDashboardContent shape used when the feature is disabled. Use this skill when requests mention Orchard Core Admin Dashboard, Create and Configure Dashboard Widgets, Enabling Admin Dashboard, Widget Configuration Properties, dashboard widget recipes, Dashboard breadcrumb, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminDashboard, DashboardPart, DashboardBreadcrumbProvider, AccessAdminDashboard, ManageAdminDashboard./orchardcore:orchardcore-search-providersfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcoreOther plugins' skills for the same job