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
projectionISiteProjectioncorpusBuilderSearchIndexBuilderindexBuilderIndexBuilderlocalizationLocalizationOptionsrecordRegistryContentRecordRegistry
Methods
GetArtifactAsync
#public Task<byte[]> GetArtifactAsync(string relativePath)
Returns the bytes for a single artifact path, or null when no artifact matches.
Parameters
relativePathstring
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
changeFileChangeNotification
Returns
FileWatchResponsePennington.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)
;
}