This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

SearchArtifactService Pennington.Search

Builds the sharded search artifacts for every configured locale and exposes them as a single path -> bytes map — the one source of truth behind SearchArtifactContentService, which serves them in dev and enumerates them for the static build.

Folds over ISiteProjection — every page's post-pipeline HTML and heading-split sections have already been produced once by the shared projection, so this service is a pure mapping from RenderedPage + HeadingSection to SearchDocument. The corpus is grouped by locale and handed to the external DeweySearch IndexBuilder; the resulting per-locale artifacts are laid out under search/{locale}/. Computed lazily and recreated on file changes when managed by FileWatchDependencyFactory.

Constructors

SearchArtifactService

#
public SearchArtifactService(ISiteProjection projection, SearchIndexBuilder corpusBuilder, IndexBuilder indexBuilder, LocalizationOptions localization, ContentRecordRegistry recordRegistry)

Creates the service; artifacts are computed lazily on first request.

Parameters

projection ISiteProjection
corpusBuilder SearchIndexBuilder
indexBuilder IndexBuilder
localization LocalizationOptions
recordRegistry ContentRecordRegistry

Methods

GetArtifactAsync

#
public Task<byte[]> GetArtifactAsync(string relativePath)

Returns the bytes for a single artifact path, or null when no artifact matches.

Parameters

relativePath string

Returns

Task<byte[]>

GetArtifactFilesAsync

#
public Task<IReadOnlyDictionary<string, byte[]>> GetArtifactFilesAsync()

Returns every artifact keyed by its relative output path (e.g. search/en/index.json).

Returns

Task<IReadOnlyDictionary<string, byte[]>>

OnFileChanged

#
public FileWatchResponse OnFileChanged(FileChangeNotification change)

Called on the file-watcher thread for every watched change. Must be quick and thread-safe.

Parameters

change FileChangeNotification

Returns

FileWatchResponse

Pennington.Search.SearchArtifactService

namespace Pennington.Search;

/// Builds the sharded search artifacts for every configured locale and exposes them as a single path -> bytes map — the one source of truth behind SearchArtifactContentService, which serves them in dev and enumerates them for the static build. Folds over ISiteProjection — every page's post-pipeline HTML and heading-split sections have already been produced once by the shared projection, so this service is a pure mapping from RenderedPage + HeadingSection to SearchDocument. The corpus is grouped by locale and handed to the external DeweySearch IndexBuilder; the resulting per-locale artifacts are laid out under search/{locale}/. Computed lazily and recreated on file changes when managed by FileWatchDependencyFactory.
public class SearchArtifactService
{
    /// Returns the bytes for a single artifact path, or null when no artifact matches.
    
public Task<byte[]> GetArtifactAsync(string relativePath)
; /// Returns every artifact keyed by its relative output path (e.g. search/en/index.json).
public Task<IReadOnlyDictionary<string, byte[]>> GetArtifactFilesAsync()
; /// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
; /// Creates the service; artifacts are computed lazily on first request.
public SearchArtifactService(ISiteProjection projection, SearchIndexBuilder corpusBuilder, IndexBuilder indexBuilder, LocalizationOptions localization, ContentRecordRegistry recordRegistry)
; }