File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
docs/src/modules/components Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,8 @@ DocSearchHit.propTypes = {
228228 hit : PropTypes . object . isRequired ,
229229} ;
230230
231+ const standaloneProducts = [ 'base-ui' , 'joy-ui' ] ;
232+
231233export default function AppSearch ( props ) {
232234 useLazyCSS (
233235 'https://cdn.jsdelivr.net/npm/@docsearch/[email protected] /dist/style.min.css' , @@ -323,6 +325,18 @@ export default function AppSearch(props) {
323325 optionalFilters . push ( `productCategoryId:${ pageContext . productCategoryId } ` ) ;
324326 }
325327
328+ // Filter out stand-alone products unless we're on their subsections
329+ let filters = undefined ;
330+ if ( standaloneProducts . length > 0 ) {
331+ const filtersPredicates = [ ] ;
332+ for ( let i = 0 ; i < standaloneProducts . length ; i += 1 ) {
333+ if ( pageContext . productId !== standaloneProducts [ i ] ) {
334+ filtersPredicates . push ( `NOT productId:${ standaloneProducts [ i ] } ` ) ;
335+ }
336+ }
337+ filters = filtersPredicates . join ( ' AND ' ) ;
338+ }
339+
326340 return (
327341 < React . Fragment >
328342 < SearchButton onRef = { searchButtonRef } onClick = { onOpen } { ...props } />
@@ -335,6 +349,7 @@ export default function AppSearch(props) {
335349 indexName = "material-ui"
336350 searchParameters = { {
337351 facetFilters : [ 'version:master' , facetFilterLanguage ] ,
352+ filters,
338353 optionalFilters,
339354 attributesToRetrieve : [
340355 // Copied from https://github.com/algolia/docsearch/blob/ce0c865cd8767e961ce3088b3155fc982d4c2e2e/packages/docsearch-react/src/DocSearchModal.tsx#L231
You can’t perform that action at this time.
0 commit comments