Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.SimpleSearch
Overview
The SimpleSearch feature indexes localized Razor content into the Eltheon in-memory data store and offers a lightweight query surface for REST endpoints. It is responsible for:
- Aggregating localization metadata (
Meta_SimpleSearch_*) into a searchable structure viaSimpleSearchIndexManager. - Hosting
SimpleSearchIndexingService, a background service built on the Service feature that rebuilds the index on demand or via triggers. - Providing
ISimpleSearchQueryso web projects can resolve filtered search results without duplicating queue/database logic.
Usage
Register the feature in your host/template:
builder.Services.AddSingleton<ISimpleSearchIndexManager, SimpleSearchIndexManager>();
builder.Services.AddSingleton<ISimpleSearchQuery, SimpleSearchQuery>();
builder.Services.AddHostedService<SimpleSearchIndexingService>();
Then inject ISimpleSearchQuery into your API/controller and call:
var results = _simpleSearchQuery.Search(query, areaFilter, CultureInfo.CurrentUICulture);
Returns IEnumerable<SearchResult> (Title, Url, Description, Keywords). A null result indicates that no index exists for the current culture.
Dependencies
- Requires the Localization feature for
CompositeStringLocalizerto enumerate page metadata. - Uses the InMemory feature (
InMemoryDatabaseFactory) to persist the search index in a global table. - Integrates with the Service feature so indexing can be scheduled or triggered through standard service configs.
Notes
- Ensure
GlobalConfig.LocalizationPathpoints to a directory containinglocalization.jsonentries withMeta_SimpleSearch_*keys; otherwise the index will remain empty. - The feature is storage agnostic: hosts can expose the query surface over REST, GraphQL or Razor by wiring
ISimpleSearchQuerywherever needed.