Configure Search
Why configure search
Section titled βWhy configure searchβVisitors expect to find content quickly. A properly configured search surfaces relevant pages, files, and blocks based on visitor queries. Without search configuration, your site relies on navigation alone, which fails for large content libraries.
Optimizely offers two search approaches. Graph is the modern, GraphQL-based content delivery and search API. Search & Navigation is the legacy full-text search service for PaaS installations.
Choose your search approach
Section titled βChoose your search approachβ| Criteria | Graph | Search & Navigation |
|---|---|---|
| Platform | SaaS and PaaS | PaaS only |
| Query language | GraphQL | .NET LINQ-style API |
| Content delivery | Yes (headless) | Search only |
| Recommended for | New projects | Existing PaaS sites |
Configure Graph search
Section titled βConfigure Graph searchβ- Navigate to Settings > Content Graph in the admin interface.
- Copy your App Key and Secret from the Graph configuration panel.
- Verify connectivity by opening the GraphQL playground link provided.
- Run a test query to confirm content is indexed.
Test Graph query
{
Content(
where: { _fulltext: { match: "getting started" } }
limit: 5
) {
items {
Name
_fulltext
Url
}
total
}
} - Verify that search results return your published content items.
Configure Search & Navigation (PaaS)
Section titled βConfigure Search & Navigation (PaaS)β- Install the
Optimizely.Search.NavigationNuGet package. - Add your service URL and API key to
appsettings.json.
Search & Navigation configuration
{
"Optimizely": {
"Search": {
"DefaultIndex": "my_site_index",
"ServiceUrl": "https://api.search.optimizely.com",
"ServiceApiKey": "your-api-key-here"
}
}
} - Navigate to Admin > Search & Navigation > Overview.
- Click Re-index to build the initial search index.
- Verify by checking the index statistics. You should see content items counted.
Customize indexed content
Section titled βCustomize indexed contentβControl which content types and properties appear in search results.
Exclude a content type from search
using Optimizely.Search;
[SearchConfiguration(IndexInDefaultSearch = false)]
public class InternalSettingsBlock : BlockData
{
// This block will not appear in search results
} - Add
[SearchConfiguration]to content types you want to exclude. - Rebuild the index after making changes.
- Verify by searching for content from the excluded type. It should not appear.
Build a search results page
Section titled βBuild a search results pageβ- Create a page type with a search query string property.
- In the controller or view, execute a search query against Graph or Search & Navigation.
- Render the results with title, excerpt, and link for each item.
- Verify by entering a search term. You should see matching results with links.
Optimize search relevance
Section titled βOptimize search relevanceβ- Open the search administration panel.
- Add boosted properties to weight titles higher than body text.
- Configure synonyms so related terms return the same results.
- Add best bets to pin specific pages to specific search terms.
- Verify by searching for a boosted term. The promoted page should appear first.
Common issues
Section titled βCommon issuesβ| Issue | Cause | Fix |
|---|---|---|
| No search results | Index not built | Run a re-index from the admin panel |
| Stale results | Content changed after last index | Enable scheduled re-indexing |
| Unexpected content in results | Content type not excluded | Add [SearchConfiguration] attribute |