Getting Started — SearchBuilder

Build the search database during prebuilding.

1. Add SearchBuilder to the prebuild project

SearchBuilder belongs in the project that prepares website assets and databases before the website is launched.

Install DMBSearchBuilder
dotnet add package DMBSearchBuilder

2. Configure the website launch profile

The builder can start the website only when it is not already available. Keep UseNoBuild enabled when the website has already been built, or disable it when prebuilding must tolerate a missing output executable. It stops only the process it started.

PreBuilding integration
await new SearchBuilderAgent().BuildFromLaunchProfileAsync(new SearchLaunchProfileBuildOptions
{
    ProjectPath = websiteProjectPath,
    LaunchSettingsPath = websiteLaunchSettingsPath,
    LaunchProfileName = "NuGet https",
    FallbackLaunchProfileName = "https",
    DatabasePath = Path.Combine(websiteRoot, "Search", "data.db"),
    MaxPages = 500,
    PreserveQueryStrings = false,
    UseNoBuild = false
});

3. Regenerate after content changes

Re-run prebuilding whenever page content, navigation, documentation data or scoring rules change. SearchBuilder will rebuild Search/data.db with normalized and weighted search terms.

Key Options
LaunchProfileName
DatabasePath
MaxPages
ExcludedPathPrefixes
PreserveQueryStrings

Review the crawler architecture and scoring storage

Understand how SearchBuilder separates the crawler, normalizer and database writer.

Architecture