From bb96d9eb33dfa8f87cf48f12d86ae8bb7950977c Mon Sep 17 00:00:00 2001 From: Arjun Attam Date: Fri, 18 Dec 2020 15:32:43 +0530 Subject: [PATCH] fix(v2): close #38 --- v2/docusaurus.config.js | 2 +- .../src/client/utils/SearchSourceFactory.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/v2/docusaurus.config.js b/v2/docusaurus.config.js index 7c4e7c857f4de..fcaf0edbaa5fb 100644 --- a/v2/docusaurus.config.js +++ b/v2/docusaurus.config.js @@ -141,7 +141,7 @@ module.exports = { { hashed: true, language: ["en"], - searchResultLimits: 8, + searchResultLimits: 10, highlightSearchTermsOnTargetPage: true, }, ], diff --git a/v2/third_party/docusaurus-search-local/src/client/utils/SearchSourceFactory.ts b/v2/third_party/docusaurus-search-local/src/client/utils/SearchSourceFactory.ts index e2dfa37bc1ee4..3eaf99cc0c918 100644 --- a/v2/third_party/docusaurus-search-local/src/client/utils/SearchSourceFactory.ts +++ b/v2/third_party/docusaurus-search-local/src/client/utils/SearchSourceFactory.ts @@ -74,10 +74,14 @@ export function SearchSourceFactory( } } - sortSearchResults(results); + // Filter out results from docs/api.md since that is covered via the + // docs/api/... pages (api.md exists for redirections from previous website) + const filteredResults = results.filter(r => r.document.u !== "/docs/api"); - processTreeStatusOfSearchResults(results); + sortSearchResults(filteredResults); - callback(results as SearchResult[]); + processTreeStatusOfSearchResults(filteredResults); + + callback(filteredResults as SearchResult[]); }; }