Skip to content

Commit

Permalink
[docs-infra] Fix search ranking when no productId
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jul 25, 2023
1 parent ca7c5c6 commit 1d3606b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ export default function AppSearch(props) {

const search = `${t('algoliaSearch')}…`;

const optionalFilters = []
if (pageContext.productId !== 'null') {
optionalFilters.push(`productId:${pageContext.productId}`);
}

return (
<React.Fragment>
<SearchButton
Expand Down Expand Up @@ -332,7 +337,7 @@ export default function AppSearch(props) {
indexName="material-ui"
searchParameters={{
facetFilters: ['version:master', facetFilterLanguage],
optionalFilters: [`productId:${pageContext.productId}`],
optionalFilters,
attributesToRetrieve: [
// Copied from https://github.com/algolia/docsearch/blob/ce0c865cd8767e961ce3088b3155fc982d4c2e2e/packages/docsearch-react/src/DocSearchModal.tsx#L231
'hierarchy.lvl0',
Expand Down

0 comments on commit 1d3606b

Please sign in to comment.