Agent skill
orchardcore-search-indexing
Skill for configuring search and indexing in Orchard Core. Covers Lucene indexing, Elasticsearch integration, search settings, index definitions, and search queries.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/orchardcore-search-indexing
Metadata
Additional technical details for this skill
- author
- CrestApps Team
- version
- 1.0
SKILL.md
Orchard Core Search & Indexing - Prompt Templates
Configure Search and Indexing
You are an Orchard Core expert. Generate search and indexing configurations for Orchard Core.
Guidelines
- Orchard Core supports Lucene and Elasticsearch as search providers.
- Enable
OrchardCore.Search.LuceneorOrchardCore.Search.Elasticsearchas needed. - Lucene indexes are stored on the local file system.
- Elasticsearch requires an external Elasticsearch cluster.
- Create indexes that specify which content types and fields to index.
- Use queries to search indexed content programmatically or via Liquid.
- Content indexing is triggered automatically when content is published or updated.
- Rebuild indexes after changing index definitions.
Enabling Search Features
{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Search",
"OrchardCore.Search.Lucene",
"OrchardCore.Indexing"
],
"disable": []
}
]
}
Lucene Index Configuration via Recipe
{
"steps": [
{
"name": "lucene-index",
"Indices": [
{
"Search": {
"AnalyzerName": "standardanalyzer",
"IndexLatest": false,
"IndexedContentTypes": [
"Article",
"BlogPost"
],
"Culture": "",
"StoreSourceData": false
}
}
]
}
]
}
Elasticsearch Configuration
Configure in appsettings.json:
{
"OrchardCore": {
"OrchardCore_Elasticsearch": {
"Url": "https://localhost:9200",
"Ports": [9200],
"ConnectionType": "SingleNodeConnectionPool"
}
}
}
Elasticsearch Index via Recipe
{
"steps": [
{
"name": "elasticsearch-index",
"Indices": [
{
"Search": {
"AnalyzerName": "standard",
"IndexLatest": false,
"IndexedContentTypes": [
"Article",
"BlogPost"
],
"Culture": "",
"StoreSourceData": false
}
}
]
}
]
}
Lucene Queries via Recipe
{
"steps": [
{
"name": "Queries",
"Queries": [
{
"Source": "Lucene",
"Name": "RecentBlogPosts",
"Index": "Search",
"Template": "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"Content.ContentItem.ContentType\":\"BlogPost\"}}]}},\"sort\":{\"Content.ContentItem.CreatedUtc\":{\"order\":\"desc\"}},\"size\":10}",
"ReturnContentItems": true,
"Schema": "[]"
}
]
}
]
}
Using Search in Liquid
{% assign results = Queries.RecentBlogPosts | query %}
{% for item in results %}
<article>
<h2>{{ item.DisplayText }}</h2>
<p>{{ item.Content.BlogPost.Subtitle.Text }}</p>
</article>
{% endfor %}
Programmatic Search Queries
using OrchardCore.Search.Lucene;
public sealed class SearchService
{
private readonly LuceneQueryService _queryService;
private readonly LuceneIndexManager _indexManager;
public SearchService(
LuceneQueryService queryService,
LuceneIndexManager indexManager)
{
_queryService = queryService;
_indexManager = indexManager;
}
public async Task<IEnumerable<string>> SearchAsync(string query)
{
var results = await _queryService.SearchAsync(
new LuceneQueryContext
{
IndexName = "Search",
DefaultSearchFields = new[] { "Content.ContentItem.FullText" }
},
query);
return results.TopDocs.ScoreDocs
.Select(hit => hit.Doc.ToString());
}
}
Custom Content Part Indexing
using OrchardCore.Indexing;
public sealed class MyPartIndexHandler : ContentPartIndexHandler<MyPart>
{
public override Task BuildIndexAsync(
MyPart part,
BuildPartIndexContext context)
{
var options = DocumentIndexOptions.Store;
context.DocumentIndex.Set(
$"{nameof(MyPart)}.{nameof(MyPart.MyField)}",
part.MyField,
options);
return Task.CompletedTask;
}
}
Registering Index Handler
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IContentPartIndexHandler, MyPartIndexHandler>();
}
}
Search Settings via Recipe
{
"steps": [
{
"name": "Settings",
"SearchSettings": {
"ProviderName": "Lucene",
"Placeholder": "Search...",
"PageSize": 10
}
}
]
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?