Skip to content

Commit

Permalink
hack(algolia): (almost) don't query posts index twice
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Apr 11, 2024
1 parent af9acc1 commit c1520b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions site/search/SearchPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,13 @@ export class InstantSearchContainer extends React.Component {
searchClient={this.searchClient}
indexName={getIndexName(SearchIndexName.Pages)}
>
{/*
We query `Pages` two times, once here and once in the <Index> component inside <SearchResults.
That's not great; but Algolia pretty much always needs a root-level index to work with - otherwise
some things like `scopedResults` don't work. See https://github.com/algolia/instantsearch/issues/6132.
We at least configure the root-level index to have `hitsPerPage={0}` so that it doesn't actually return any hits.
*/}
<Configure hitsPerPage={0} />
<div className="search-panel">
<SearchBox
placeholder={DEFAULT_SEARCH_PLACEHOLDER}
Expand Down

0 comments on commit c1520b0

Please sign in to comment.