feat(algolia): add facets based on version for search #1051
+22
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

When browsing older documentation versions (for example, v1.20), search results currently all content from latest....
This leads to confusion when users discover features or APIs in search results that don’t actually exist in the version they’re viewing.
This PR introduces version-aware search filtering using Algolia facet filters. https://www.algolia.com/doc/guides/managing-results/refine-results/faceting
Search results will be restricted to the documentation version the user is currently viewing.
.Page.Params.version.facetFiltersvalue dynamically:docsearch:version:0.0.0-master, which matches the existing meta tag convention where master is labeled0.0.0-masterto keep it de-ranked in searchBackground
Each page already includes:
which the Algolia crawler indexes.
Required: Algolia configuration
After this PR is merged, someone with Algolia admin access must enable faceting:
Open Algolia Dashboard
Go to the crossplane index
Navigate to Configuration → Facets
Add:
filterOnly(docsearch:version)
to Attributes for faceting
Save
Important: The docsearch:version attribute is already indexed, so no re-crawl is required.Testing:
To verify this PR:
we see the facetFilters
Fixes: #1008