Skip to content

Commit

Permalink
[deploy_website] Fix multi-website search (#5801)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored and ardatan committed Apr 7, 2021
1 parent d563887 commit 96e9a9b
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 174 deletions.
4 changes: 2 additions & 2 deletions algolia/config.json
Expand Up @@ -3,9 +3,9 @@
"start_urls": [
"https://graphql-code-generator.com/",
"https://graphql-code-generator.com/docs/getting-started/index",
"https://graphql-mesh.com/docs/",
"https://graphql-mesh.com/",
"https://graphql-mesh.com/docs/getting-started/introduction",
"https://www.graphql-tools.com/docs/",
"https://www.graphql-tools.com/",
"https://www.graphql-tools.com/docs/introduction",
"https://graphql-config.com/",
"https://graphql-inspector.com/docs/",
Expand Down
14 changes: 7 additions & 7 deletions patches/@docsearch+react+3.0.0-alpha.34.patch
@@ -1,8 +1,8 @@
diff --git a/node_modules/@docsearch/react/dist/esm/DocSearchModal.js b/node_modules/@docsearch/react/dist/esm/DocSearchModal.js
index 12c8367..41e9bec 100644
index cf68d4f..cdc8b42 100644
--- a/node_modules/@docsearch/react/dist/esm/DocSearchModal.js
+++ b/node_modules/@docsearch/react/dist/esm/DocSearchModal.js
@@ -230,7 +230,7 @@ export function DocSearchModal(_ref) {
@@ -233,7 +233,7 @@ export function DocSearchModal(_ref) {
getItems: function getItems() {
return Object.values(groupBy(items, function (item) {
return item.hierarchy.lvl1;
Expand All @@ -12,15 +12,15 @@ index 12c8367..41e9bec 100644
return _objectSpread(_objectSpread({}, item), {}, {
// eslint-disable-next-line @typescript-eslint/camelcase
diff --git a/node_modules/@docsearch/react/dist/esm/Results.js b/node_modules/@docsearch/react/dist/esm/Results.js
index 2b3096c..ca6da66 100644
index 2b3096c..154e45e 100644
--- a/node_modules/@docsearch/react/dist/esm/Results.js
+++ b/node_modules/@docsearch/react/dist/esm/Results.js
@@ -91,7 +91,7 @@ function Result(_ref) {
className: "DocSearch-Hit-title",
hit: item,
attribute: "hierarchy.lvl1"
- }), item.content && /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px"}}, `${item.url}`), item.content && /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px", color: "#afbb93"}}, `${item.url}`), item.content && /*#__PURE__*/React.createElement(Snippet, {
className: "DocSearch-Hit-path",
hit: item,
attribute: "content"
Expand All @@ -29,7 +29,7 @@ index 2b3096c..ca6da66 100644
hit: item,
attribute: "hierarchy.".concat(item.type)
- }), /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px"}}, `${item.url}`), /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px", color: "#afbb93"}}, `${item.url}`), item.content && /*#__PURE__*/React.createElement(Snippet, {
className: "DocSearch-Hit-path",
hit: item,
attribute: "hierarchy.lvl1"
Expand All @@ -38,7 +38,7 @@ index 2b3096c..ca6da66 100644
hit: item,
attribute: "content"
- }), /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px"}}, `${item.url}`), /*#__PURE__*/React.createElement(Snippet, {
+ }),/*#__PURE__*/React.createElement('div', {style: {fontSize: "10px", color: "#afbb93"}}, `${item.url}`), item.content && /*#__PURE__*/React.createElement(Snippet, {
className: "DocSearch-Hit-path",
hit: item,
attribute: "hierarchy.lvl1"
attribute: "hierarchy.lvl1"
35 changes: 35 additions & 0 deletions patches/@docusaurus+theme-search-algolia+2.0.0-alpha.72.patch
@@ -0,0 +1,35 @@
diff --git a/node_modules/@docusaurus/theme-search-algolia/src/theme/SearchBar/index.js b/node_modules/@docusaurus/theme-search-algolia/src/theme/SearchBar/index.js
index 033a105..a4148d8 100644
--- a/node_modules/@docusaurus/theme-search-algolia/src/theme/SearchBar/index.js
+++ b/node_modules/@docusaurus/theme-search-algolia/src/theme/SearchBar/index.js
@@ -16,6 +16,7 @@ import useSearchQuery from '@theme/hooks/useSearchQuery';
import {DocSearchButton, useDocSearchKeyboardEvents} from '@docsearch/react';
import useAlgoliaContextualFacetFilters from '@theme/hooks/useAlgoliaContextualFacetFilters';
import {translate} from '@docusaurus/Translate';
+import {CallEnum} from '@algolia/transporter';

let DocSearchModal = null;

@@ -101,7 +102,7 @@ function DocSearch({contextualSearch, ...props}) {

const navigator = useRef({
navigate({itemUrl}) {
- history.push(itemUrl);
+ window.location.assign(itemUrl);
},
}).current;

@@ -132,6 +133,13 @@ function DocSearch({contextualSearch, ...props}) {
siteMetadata.docusaurusVersion,
);

+ const algoliaHost = 'the-guild.dev/api/algolia';
+ searchClient.transporter.hosts.forEach(host => {
+ if ((host.accept & CallEnum.Read) !== 0) {
+ host.url = algoliaHost;
+ }
+ });
+
return searchClient;
},
[siteMetadata.docusaurusVersion],

This file was deleted.

1 change: 0 additions & 1 deletion website/docusaurus.config.js
Expand Up @@ -19,7 +19,6 @@ module.exports = {
appId: 'ANRJKXZTRW',
apiKey: '811d453fc7f80306044dd5cc4b87e064',
indexName: 'theguild',
algoliaOptions: {},
},
navbar: {
title: 'GraphQL Code Generator',
Expand Down
4 changes: 2 additions & 2 deletions website/package.json
Expand Up @@ -14,8 +14,8 @@
"file-loader": "6.2.0",
"style-loader": "2.0.0",
"monaco-editor-webpack-plugin": "1.9.1",
"@docusaurus/core": "2.0.0-alpha.ffe8b6106",
"@docusaurus/preset-classic": "2.0.0-alpha.ffe8b6106",
"@docusaurus/core": "2.0.0-alpha.72",
"@docusaurus/preset-classic": "2.0.0-alpha.72",
"@graphql-codegen/config-schema": "1.17.9",
"babel-preset-minify": "0.5.1",
"classnames": "2.3.1",
Expand Down

0 comments on commit 96e9a9b

Please sign in to comment.