Registers Orchard Core indexing sources for search providers including Elasticsearch, Lucene, and Azure AI Search. Covers AddIndexingSource wrappers, source metadata, options-gated registration, and custom record indexing with NamedIndexingService.
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.
An indexing source registers provider-specific index, document-index, and index-name managers together with source metadata for the index-profile UI. Use the provider's real wrapper when one exists.
Orchard Core's Elasticsearch provider exposes
AddElasticsearchIndexingSource. Its content startup registers the source
with IndexingConstants.ContentsIndexSource:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Data.Migration;
using OrchardCore.Elasticsearch;
using OrchardCore.Elasticsearch.Core.Handlers;
using OrchardCore.Indexing.Core;
using OrchardCore.Modules;
namespace MyModule;
[RequireFeatures("OrchardCore.Contents")]
public sealed class ContentsStartup : StartupBase
{
private readonly IStringLocalizer<ContentsStartup> _localizer;
public ContentsStartup(IStringLocalizer<ContentsStartup> localizer)
{
_localizer = localizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddDataMigration<IndexingMigrations>();
services
.AddIndexProfileHandler<ElasticsearchContentIndexProfileHandler>()
.AddElasticsearchIndexingSource(IndexingConstants.ContentsIndexSource, options =>
{
options.DisplayName = _localizer["Content in Elasticsearch"];
options.Description = _localizer["Create an Elasticsearch index based on site contents."];
});
}
}
The generic primitive is
AddIndexingSource<TIndexManager, TDocumentIndexManager, TIndexNameProvider>.
The type parameters must implement IIndexManager,
IDocumentIndexManager, and IIndexNameProvider, respectively. The
registration uses keyed services by provider name, so a custom provider should
resolve its managers by that key.
Indexing tasks use a shared category string. Use
IndexingConstants.ContentsIndexSource for content records, or define a
stable category for another record source and use the same value when creating
tasks and reading them with IIndexingTaskManager. Categories are universal
across providers; they are not provider-specific index names.
using OrchardCore.Indexing;
using OrchardCore.Indexing.Core;
using OrchardCore.Indexing.Models;
await indexingTaskManager.CreateTaskAsync(new CreateIndexingTaskContext(
recordId,
IndexingConstants.ContentsIndexSource,
RecordIndexingTaskTypes.Update));
Content index field names are centralized in ContentIndexingConstants from
the OrchardCore.Contents.Indexing namespace. Use these constants instead of
duplicating names such as Content.ContentItem.ContentType or
Content.ContentItem.FullText.
Use its options-gated overload only when a source must be hidden until valid provider configuration exists.
The following namespace and types are intentionally fictional placeholders for a custom provider. They are not Orchard Core APIs and must be replaced by the provider's own manager implementations:
// Fictional Contoso provider example. S is an IStringLocalizer injected in the startup.
// DisplayName and Description are LocalizedString values.
services.AddIndexingSource<
ContosoIndexManager,
ContosoDocumentIndexManager,
ContosoIndexNameProvider>(
"Contoso",
implementationType: "Products",
options =>
{
options.DisplayName = S["Products in Contoso"];
options.Description = S["Create a Contoso index for product records."];
});
Do not treat OrchardCore.OpenSearch or AddOpenSearchIndexingSource as
built-in Orchard Core APIs; no such provider exists in Orchard Core 4.0.
The built-in wrappers are AddLuceneIndexingSource,
AddElasticsearchIndexingSource and AddAzureAISearchIndexingSource.
Pair a custom source with an
IndexProfileHandlerBase implementation only when it owns source-specific
defaults or mappings.
providerName selects the keyed IIndexManager, IDocumentIndexManager and IIndexNameProvider; implementationType is the source category, stored as IndexProfile.Type and used as the indexing task category.TryAdd, so the first registration for a provider name wins. To put a new record type into Lucene, Elasticsearch or Azure AI Search, call the provider wrapper with a new category (for example AddLuceneIndexingSource("Products")) and reuse the provider's managers. Implement your own managers only for a new provider name.CreateOrUpdateIndexProfile step rejects a profile whose provider and type pair was never registered ("Unable to find a provider named ... with the type ...").Indexing custom records (not content items) into an existing provider takes five pieces. The IProductStore and Product types below are your own.
IIndexingTaskManager queues tasks and writes them at the end of the shell scope, keeping one task per record and category.await _indexingTaskManager.CreateTaskAsync(new CreateIndexingTaskContext(
product.Id,
ProductIndexingService.Category,
RecordIndexingTaskTypes.Update));
NamedIndexingService (namespace OrchardCore.Indexing.Core). The base class reads the task log for every profile of the category from each profile's last task id, under a distributed lock, in batches of BatchSize (100), runs every IDocumentIndexHandler, writes with AddOrUpdateDocumentsAsync, and advances the cursor. Return null for tasks to skip.using Microsoft.Extensions.Logging;
using OrchardCore.Indexing;
using OrchardCore.Indexing.Core;
public sealed class ProductIndexingService : NamedIndexingService
{
public const string Category = "Products";
private readonly IProductStore _productStore;
public ProductIndexingService(
IProductStore productStore,
IIndexProfileStore indexProfileStore,
IIndexingTaskManager indexingTaskManager,
IEnumerable<IDocumentIndexHandler> documentIndexHandlers,
IServiceProvider serviceProvider,
ILogger<ProductIndexingService> logger)
: base(Category, indexProfileStore, indexingTaskManager, documentIndexHandlers, serviceProvider, logger)
{
_productStore = productStore;
}
protected override async Task<BuildDocumentIndexContext> GetBuildDocumentIndexAsync(IndexProfileEntryContext entry, RecordIndexingTask task)
{
if (task.Type != RecordIndexingTaskTypes.Update)
{
return null;
}
var product = await _productStore.FindByIdAsync(task.RecordId);
if (product is null)
{
return null;
}
return new BuildDocumentIndexContext(
new DocumentIndex(product.Id),
product,
[Category],
entry.DocumentIndexManager.GetContentIndexSettings());
}
}
DocumentIndex; every handler sees every document, so check the record type.public sealed class ProductDocumentIndexHandler : IDocumentIndexHandler
{
public Task BuildIndexAsync(BuildDocumentIndexContext context)
{
if (context.Record is not Product product)
{
return Task.CompletedTask;
}
context.DocumentIndex.Set("Products.Name", product.Name, DocumentIndexOptions.Store);
context.DocumentIndex.Set("Products.Price", product.Price, DocumentIndexOptions.Store);
return Task.CompletedTask;
}
}
IndexProfileHandlerBase (namespace OrchardCore.Indexing.Core.Handlers) that syncs on SynchronizedAsync and rewinds the cursor on ResetAsync.using Microsoft.Extensions.DependencyInjection;
using OrchardCore.BackgroundTasks;
using OrchardCore.Indexing;
using OrchardCore.Indexing.Core.Handlers;
using OrchardCore.Indexing.Models;
[BackgroundTask(
Title = "Products Index Updater",
Schedule = "* * * * *",
Description = "Indexes changed products.")]
public sealed class ProductIndexingBackgroundTask : IBackgroundTask
{
public Task DoWorkAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken)
=> serviceProvider.GetRequiredService<ProductIndexingService>().ProcessRecordsForAllIndexesAsync();
}
public sealed class ProductIndexProfileHandler : IndexProfileHandlerBase
{
private readonly IServiceProvider _serviceProvider;
private readonly ProductIndexingService _indexingService;
public ProductIndexProfileHandler(IServiceProvider serviceProvider, ProductIndexingService indexingService)
{
_serviceProvider = serviceProvider;
_indexingService = indexingService;
}
public override Task SynchronizedAsync(IndexProfileSynchronizedContext context)
=> context.IndexProfile.Type == ProductIndexingService.Category
? _indexingService.ProcessRecordsAsync([context.IndexProfile.Id])
: Task.CompletedTask;
public override async Task ResetAsync(IndexProfileResetContext context)
{
if (context.IndexProfile.Type != ProductIndexingService.Category)
{
return;
}
var documentIndexManager = _serviceProvider.GetKeyedService<IDocumentIndexManager>(context.IndexProfile.ProviderName);
if (documentIndexManager is not null)
{
await documentIndexManager.SetLastTaskIdAsync(context.IndexProfile, 0);
}
}
}
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.BackgroundTasks;
using OrchardCore.Indexing;
using OrchardCore.Indexing.Core;
using OrchardCore.Lucene;
using OrchardCore.Modules;
[RequireFeatures("OrchardCore.Lucene")]
public sealed class ProductLuceneStartup : StartupBase
{
private readonly IStringLocalizer S;
public ProductLuceneStartup(IStringLocalizer<ProductLuceneStartup> stringLocalizer)
{
S = stringLocalizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<ProductIndexingService>();
services.AddScoped<IDocumentIndexHandler, ProductDocumentIndexHandler>();
services.AddSingleton<IBackgroundTask, ProductIndexingBackgroundTask>();
services
.AddIndexProfileHandler<ProductIndexProfileHandler>()
.AddLuceneIndexingSource(ProductIndexingService.Category, options =>
{
options.DisplayName = S["Products in Lucene"];
options.Description = S["Create a Lucene index for product records."];
});
}
}
The worker path handles Update tasks only, like the content source. When a record is deleted, also remove it right away with IDocumentIndexManager.DeleteDocumentsAsync(profile, [id]) for each profile of the category (IIndexProfileStore.GetByTypeAsync(Category)), the way content removal is handled.
Orchard Core 4.0 also has data sources (IDataSource, registered with
services.AddDataSource<T>() in the Data Pipelines Core feature). They are a
different extension point: a data source exposes tabular data sets that data
pipelines and reports read in batches with a user's permissions, while an
indexing source feeds documents into a search provider index from the
indexing task log. Use orchardcore-data-sources for the former.
Provider connection settings that options-gated sources depend on are read
from OrchardCore:Search:Elasticsearch and OrchardCore:Search:AzureAISearch
since Orchard Core 4.0 (formerly OrchardCore_Elasticsearch and
OrchardCore_AzureAISearch). Azure AI Search options are refreshed through
IOptionsMonitor<AzureAISearchDefaultOptions> when the admin settings change.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/orchardcore:orchardcore-indexing-sourcesfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcore140 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.Other plugins' skills for the same job