orchardcore-query-indexing

Implements OrchardCore queries, index profiles, and content index handlers for search.

8.2k|2.6k|Updated Nov 19, 2014
One-click install
npx skills add https://github.com/OrchardCMS/OrchardCore --skill orchardcore-query-indexing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: orchardcore-query-indexing
Source: https://github.com/OrchardCMS/OrchardCore/tree/main/.agents/skills/orchardcore-query-indexing
Command: npx skills add https://github.com/OrchardCMS/OrchardCore --skill orchardcore-query-indexing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

OrchardCore developers often confuse its three indexing concepts—stored queries, full-text index profiles, and YesSql MapIndex tables—and struggle to wire up search correctly. This Skill guides you through defining SQL/Lucene/Elasticsearch queries, building full-text index profiles, and writing content part/field index handlers following project conventions.

Core Features & Use Cases

  • Stored Queries: Create and execute named SQL, Lucene, or Elasticsearch queries via recipe steps or IQueryManager, with Liquid-templated SQL and optional ContentItem hydration.
  • Full-Text Indexing: Build index profiles for Lucene, Elasticsearch, or Azure AI Search, and implement IContentPartIndexHandler/IContentFieldIndexHandler to index custom part and field data.
  • Use Case: You need blog posts searchable on your OrchardCore site. Create a CreateOrUpdateIndexProfile recipe step targeting the BlogPost content type, register a part index handler for custom fields, then query the index through ISearchService.

Quick Start

Ask the AI to create an OrchardCore index profile and a content part index handler so your custom content type becomes searchable in Lucene.

Frequently Asked Questions about orchardcore-query-indexing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create and run a SQL query in OrchardCore?

Create a stored query with Source set to Sql and a Liquid-rendered Template, either through the queries recipe step or IQueryManager.NewAsync and SaveAsync. Execute it with IQueryManager.ExecuteQueryAsync, passing parameters that become Liquid variables in the template.

How do I make OrchardCore content searchable with Lucene or Elasticsearch?

Create an index profile using the CreateOrUpdateIndexProfile recipe step, specifying the provider, index name, and indexed content types. Content changes then trigger indexing tasks that build DocumentIndex entries stored by the chosen provider.

What is the difference between OrchardCore index profiles and YesSql MapIndex tables?

Index profiles are full-text search indexes stored in Lucene, Elasticsearch, or Azure AI Search and built by document index handlers. YesSql MapIndex tables are relational SQL tables created with SchemaBuilder for fast database lookups, covered by data migrations instead.

How do I index a custom content part or field in OrchardCore?

Implement ContentPartIndexHandler<TPart> or ContentFieldIndexHandler<TField> and set values on context.DocumentIndex for each key in context.Keys. Register the handler with services.AddScoped<IContentPartIndexHandler, YourHandler>() so the indexing pipeline invokes it.

Which OrchardCore recipe steps manage search indexes?

Use CreateOrUpdateIndexProfile to create or update index profiles for any provider, ResetIndex to re-sync from the last position, and RebuildIndex to drop and fully rebuild. The older lucene-index and ElasticIndexSettings steps are deprecated.

Why is my OrchardCore search returning draft content?

The index profile's ContentIndexMetadata.IndexLatest setting controls versioning: true indexes the latest draft versions while false indexes only published content. Set it to match what your search UI should expose.