Provides guidance on Orchard Core's indexing infrastructure: content item indexing lifecycle, index handlers, index profiles, recipe steps (CreateOrUpdateIndexProfile, ResetIndex, RebuildIndex), permissions, and custom indexing sources.
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.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate code and configuration for the Orchard Core indexing infrastructure, including custom indexing sources and index lifecycle management.
OrchardCore.Indexing as the core indexing module that provides the abstraction layer for all index providers.CreateOrUpdateIndexProfile recipe step to create or update index profiles.ResetIndex recipe step to restart indexing without deleting existing entries.RebuildIndex recipe step to delete and recreate the full index.OrchardCore.Indexing.Worker (depends on OrchardCore.Contents) for the background task that keeps indexes in sync with content item changes.OrchardCore.Indexing.Core.IndexingPermissions: ManageIndexes, QuerySearchIndex and the per-profile CreateDynamicPermission(indexProfile) (QueryIndex_{ProfileName}).IDataSource, see orchardcore-data-sources).MapIndex tables (relational lookups created in migrations, see orchardcore-yessql-indexes) and not saved queries (see orchardcore-content-queries).{ "steps": [...] }.sealed modifier.{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Indexing"
],
"disable": []
}
]
}
The indexing module uses an append-only task log where each entry represents either an Update or a Deletion. Consumers track changes independently using their own cursor positions. This enables:
With OrchardCore.Contents enabled, content changes reach index profiles of type Content by two paths.
IndexingContentHandler collects items created, updated, published, unpublished, saved as draft or removed during the request (preview requests are ignored) and, in a ShellScope deferred task after the request, rebuilds their documents in every Content profile whose IndexedContentTypes, Culture and IndexLatest match.CreateIndexingTaskContentHandler also appends an Update or Delete task with the Content category (IndexingConstants.ContentsIndexSource). With OrchardCore.Indexing.Worker enabled, ContentIndexingBackgroundTask ("Indexes Content Updater", every minute) calls ContentIndexingService.ProcessRecordsForAllIndexesAsync(), which reads tasks after each profile's last task id in batches of 100 under a distributed lock and catches up anything missed (other nodes, failures, resets).Both paths build a ContentItemDocumentIndex, run every IDocumentIndexHandler (the content coordinator in turn calls each IContentPartIndexHandler and IContentFieldIndexHandler), and write through the provider's IDocumentIndexManager (AddOrUpdateDocumentsAsync is an upsert, DeleteDocumentsAsync removes). The worker then advances the cursor with SetLastTaskIdAsync. A profile whose physical index does not exist is skipped with a warning; rebuild it.
Part and field handlers live in OrchardCore.Indexing.Abstractions (namespace OrchardCore.Indexing) and are registered as scoped services. orchardcore-search-indexing has full part and document handler examples.
using OrchardCore.ContentFields.Fields;
using OrchardCore.Indexing;
public sealed class {{FieldName}}IndexHandler : ContentFieldIndexHandler<{{FieldName}}>
{
public override Task BuildIndexAsync({{FieldName}} field, BuildFieldIndexContext context)
{
// Honors the per-field index settings (stored, keyword, sanitized).
var options = context.Settings.ToOptions();
foreach (var key in context.Keys)
{
context.DocumentIndex.Set(key, field.Text, options);
}
return Task.CompletedTask;
}
}
// services.AddScoped<IContentFieldIndexHandler, {{FieldName}}IndexHandler>();
// services.AddScoped<IContentPartIndexHandler, {{PartName}}IndexHandler>();
// services.AddScoped<IDocumentIndexHandler, {{Name}}DocumentIndexHandler>();
context.Keys holds every index field name to write; always loop it. For a part the keys are {PartName} and {ContentType}.{PartName}; field keys append .{FieldName}.ContentPartIndexHandler<TPart> only runs for parts of type TPart; ContentFieldIndexHandler<TField> only for fields whose definition is TField.BuildPartIndexContext adds ContentTypePartDefinition; BuildFieldIndexContext adds ContentPart and ContentPartFieldDefinition. The source record is context.Record and context.Settings is the provider's IContentIndexSettings.IDocumentIndexHandler.BuildIndexAsync(BuildDocumentIndexContext) runs once per document; check context.Record type first. Its default-implemented DocumentsAddedOrUpdatedAsync and DocumentsDeletedAsync hooks run after the provider writes.DocumentIndex.Set(name, value, options) overloads map to DocumentIndex.Types:
| Value | Type |
|---|---|
string, IHtmlContent | Text |
DateTimeOffset? | DateTime |
int? | Integer |
bool? | Boolean |
double?, decimal? | Number |
DocumentIndex.GeoPoint | GeoPoint |
float[] with dimensions | Vector |
object (optional metadata) | Complex |
DocumentIndexOptions is a flags enum: None (analyzed text), Store (retrievable from the index), Sanitize (strip HTML before indexing), Keyword (not analyzed, exact match).
{
"steps": [
{
"name": "CreateOrUpdateIndexProfile",
"indexes": [
{
"Id": "unique-profile-id",
"Name": "ArticlesIndex",
"IndexName": "articles",
"ProviderName": "Lucene",
"Type": "Content",
"Properties": {
"ContentIndexMetadata": {
"IndexLatest": false,
"IndexedContentTypes": ["Article", "BlogPost"],
"Culture": "any"
}
}
}
]
}
]
}
| Property | Description |
|---|---|
Id | Optional unique identifier for the index profile. |
Name | Unique display name for the profile. |
IndexName | Physical index name used by the provider. |
ProviderName | The search provider: "Lucene", "Elasticsearch", or "AzureAISearch". |
Type | Source category. Use "Content" for content items or a custom category name. |
Properties | Provider-specific and source-specific metadata. |
| Property | Description |
|---|---|
IndexLatest | When true, indexes both published and draft content items. Default false. |
IndexedContentTypes | Array of content type technical names to include in the index. |
Culture | "any" to index all cultures, or a specific culture code (e.g., "en-US"). |
Restarts the indexing process from the beginning. Existing entries are preserved; new or updated items are added. The operation runs asynchronously in the background.
{
"steps": [
{
"name": "ResetIndex",
"indexNames": [
"ArticlesIndex",
"BlogPostsIndex"
]
}
]
}
To reset all indices:
{
"steps": [
{
"name": "ResetIndex",
"IncludeAll": true
}
]
}
Deletes the existing index and rebuilds from scratch. The operation runs asynchronously in the background.
{
"steps": [
{
"name": "RebuildIndex",
"indexNames": [
"ArticlesIndex",
"BlogPostsIndex"
]
}
]
}
To rebuild all indices:
{
"steps": [
{
"name": "RebuildIndex",
"IncludeAll": true
}
]
}
An indexing source is a provider name plus a source category (the profile Type). The provider's IIndexManager, IDocumentIndexManager and IIndexNameProvider are registered as keyed services under the provider name with TryAdd, so the first registration for a provider name wins.
services.AddLuceneIndexingSource("Products", ...), then feed the category's task log (see orchardcore-indexing-sources).1. Implement IIndexManager — Creates, rebuilds, and deletes provider indexes:
using OrchardCore.Indexing;
namespace MyModule;
public sealed class ProductIndexManager : IIndexManager
{
public Task<bool> CreateAsync(IndexProfile indexProfile)
=> throw new NotImplementedException();
public Task<bool> RebuildAsync(IndexProfile indexProfile)
=> throw new NotImplementedException();
public Task<bool> DeleteAsync(IndexProfile indexProfile)
=> throw new NotImplementedException();
public Task<bool> ExistsAsync(string indexFullName)
=> throw new NotImplementedException();
}
2. Implement IDocumentIndexManager — Writes documents and tracks the task cursor:
using OrchardCore.Indexing;
namespace MyModule;
public sealed class ProductDocumentIndexManager : IDocumentIndexManager
{
public Task<bool> AddOrUpdateDocumentsAsync(IndexProfile indexProfile, IEnumerable<DocumentIndex> documents)
=> throw new NotImplementedException();
public Task<bool> DeleteDocumentsAsync(IndexProfile indexProfile, IEnumerable<string> documentIds)
=> throw new NotImplementedException();
public Task<bool> DeleteAllDocumentsAsync(IndexProfile indexProfile)
=> throw new NotImplementedException();
public Task<long> GetLastTaskIdAsync(IndexProfile indexProfile)
=> throw new NotImplementedException();
public Task SetLastTaskIdAsync(IndexProfile indexProfile, long lastTaskId)
=> throw new NotImplementedException();
public IContentIndexSettings GetContentIndexSettings()
=> throw new NotImplementedException();
}
3. Implement IIndexNameProvider — Provides physical names for profiles:
using OrchardCore.Indexing;
namespace MyModule;
public sealed class ProductIndexNameProvider : IIndexNameProvider
{
public string GetFullIndexName(string name) => name;
}
4. Register the custom source in Startup.cs:
using OrchardCore.Modules;
using Microsoft.Extensions.Localization;
namespace MyModule;
[Feature("MyModule.ProductIndex")]
public sealed class Startup : StartupBase
{
private readonly IStringLocalizer S;
public Startup(IStringLocalizer<Startup> stringLocalizer)
{
S = stringLocalizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddIndexingSource<ProductIndexManager, ProductDocumentIndexManager, ProductIndexNameProvider>(
"Contoso",
"Products",
o =>
{
o.DisplayName = S["Products in Contoso"];
o.Description = S["Creates a search index for product data."];
});
}
}
Use IIndexProfileManager (namespace OrchardCore.Indexing) instead of writing profiles directly; it runs the IIndexProfileHandler pipeline and validation. Creating the profile does not create the physical index; do what the CreateOrUpdateIndexProfile step does and call the provider's keyed IIndexManager.
using System.Text.Json.Nodes;
using Microsoft.Extensions.DependencyInjection;
using OrchardCore.Indexing;
public sealed class ArticleIndexSetup
{
private readonly IIndexProfileManager _indexProfileManager;
private readonly IServiceProvider _serviceProvider;
public ArticleIndexSetup(IIndexProfileManager indexProfileManager, IServiceProvider serviceProvider)
{
_indexProfileManager = indexProfileManager;
_serviceProvider = serviceProvider;
}
public async Task EnsureAsync()
{
if (await _indexProfileManager.FindByNameAsync("ArticlesIndex") is not null)
{
return;
}
// The data shape matches one entry of the CreateOrUpdateIndexProfile step.
var profile = await _indexProfileManager.NewAsync("Lucene", "Content", new JsonObject
{
["Name"] = "ArticlesIndex",
["IndexName"] = "articles",
["Properties"] = new JsonObject
{
["ContentIndexMetadata"] = new JsonObject
{
["IndexedContentTypes"] = new JsonArray("Article"),
["Culture"] = "any",
},
},
});
var validation = await _indexProfileManager.ValidateAsync(profile);
if (!validation.Succeeded)
{
return;
}
await _indexProfileManager.CreateAsync(profile);
var indexManager = _serviceProvider.GetRequiredKeyedService<IIndexManager>(profile.ProviderName);
if (!await indexManager.CreateAsync(profile))
{
await _indexProfileManager.DeleteAsync(profile);
return;
}
// Indexes the existing records after the request ends.
await _indexProfileManager.SynchronizeAsync(profile);
}
}
| Member | Purpose |
|---|---|
NewAsync(providerName, type, data) | Build a profile for a registered provider and source category. |
ValidateAsync / CreateAsync / UpdateAsync(profile, data) / DeleteAsync | Validate and persist the profile. |
FindByIdAsync, FindByNameAsync, FindByNameAndProviderAsync, GetAllAsync, GetByProviderAsync, GetAsync(provider, type), PageAsync | Look up profiles. |
SynchronizeAsync | Run the profile handlers' synchronization (indexing the source records) in a background job after the request. |
ResetAsync | Run the profile handlers' reset so the profile is re-indexed from the start. |
To provide a configuration screen for a custom indexing source:
DisplayDriver<IndexProfile> to render configuration UI.IIndexProfileHandler (or inherit IndexProfileHandlerBase) to react to lifecycle events like creation, update, or deletion.The Indexing deployment category provides Index Profiles (exports CreateOrUpdateIndexProfile), Reset Indexes (ResetIndex) and Rebuild Indexes (RebuildIndex). Each takes IncludeAll or a list of IndexNames.
| Permission | Member | Notes |
|---|---|---|
ManageIndexes | IndexingPermissions.ManageIndexes | Manage index profiles. Implies provider manage permissions such as ManageElasticIndexes. |
QuerySearchIndex | IndexingPermissions.QuerySearchIndex | Query any index. |
QueryIndex_{ProfileName} | IndexingPermissions.CreateDynamicPermission(indexProfile) | Query one index; implied by ManageIndexes and QuerySearchIndex. |
Authorize a query against a specific profile with authorizationService.AuthorizeAsync(user, IndexingPermissions.QuerySearchIndex, indexProfile); the indexing authorization handler resolves the dynamic permission.
lucene-index, lucene-index-reset, lucene-index-rebuild, ElasticIndexSettings and azureai-index-create still run but are obsolete; use CreateOrUpdateIndexProfile, ResetIndex and RebuildIndex.OrchardCore.Search.Permissions.QuerySearchIndex was removed; use OrchardCore.Indexing.Core.IndexingPermissions.QuerySearchIndex.ElasticsearchIndexPermissionHelper.GetElasticIndexPermission(string) was removed; use IndexingPermissions.CreateDynamicPermission(IndexProfile).DeploymentStep.Category and Title are read-only virtual LocalizationSource properties; custom indexing deployment steps override them, for example [JsonIgnore] public override LocalizationSource Category => CommonLocalizationSources.Search; (see orchardcore-deployments).The admin dashboard under Search > Indexes provides:
Official Orchard Core videos shown on the documentation page:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, indexing, index-profiles, content-indexing, lucene, elasticsearch
/orchardcore:orchardcore-indexingfrom 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