@docusaurus/theme-search-algolia 0.0.0-6000 → 0.0.0-6003

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,10 +4,18 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { useContextualSearchFilters } from '@docusaurus/theme-common';
8
- // Translate search-engine agnostic search filters to Algolia search filters
7
+ import { DEFAULT_SEARCH_TAG } from '@docusaurus/theme-common/internal';
8
+ import { useDocsContextualSearchTags } from '@docusaurus/plugin-content-docs/client';
9
+ import useDocusaurusContext from '@docusaurus/core/src/client/exports/useDocusaurusContext';
10
+ function useSearchTags() {
11
+ // only docs have custom search tags per version
12
+ const docsTags = useDocsContextualSearchTags();
13
+ return [DEFAULT_SEARCH_TAG, ...docsTags];
14
+ }
15
+ // Translate search-engine agnostic search tags to Algolia search filters
9
16
  export function useAlgoliaContextualFacetFilters() {
10
- const { locale, tags } = useContextualSearchFilters();
17
+ const locale = useDocusaurusContext().i18n.currentLocale;
18
+ const tags = useSearchTags();
11
19
  // Seems safe to convert locale->language, see AlgoliaSearchMetadata comment
12
20
  const languageFilter = `language:${locale}`;
13
21
  const tagsFilter = tags.map((tag) => `docusaurus_tag:${tag}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "0.0.0-6000",
3
+ "version": "0.0.0-6003",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "sideEffects": [
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@docsearch/react": "^3.5.2",
37
- "@docusaurus/core": "0.0.0-6000",
38
- "@docusaurus/logger": "0.0.0-6000",
39
- "@docusaurus/plugin-content-docs": "0.0.0-6000",
40
- "@docusaurus/theme-common": "0.0.0-6000",
41
- "@docusaurus/theme-translations": "0.0.0-6000",
42
- "@docusaurus/utils": "0.0.0-6000",
43
- "@docusaurus/utils-validation": "0.0.0-6000",
37
+ "@docusaurus/core": "0.0.0-6003",
38
+ "@docusaurus/logger": "0.0.0-6003",
39
+ "@docusaurus/plugin-content-docs": "0.0.0-6003",
40
+ "@docusaurus/theme-common": "0.0.0-6003",
41
+ "@docusaurus/theme-translations": "0.0.0-6003",
42
+ "@docusaurus/utils": "0.0.0-6003",
43
+ "@docusaurus/utils-validation": "0.0.0-6003",
44
44
  "algoliasearch": "^4.18.0",
45
45
  "algoliasearch-helper": "^3.13.3",
46
46
  "clsx": "^2.0.0",
@@ -51,7 +51,7 @@
51
51
  "utility-types": "^3.10.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@docusaurus/module-type-aliases": "0.0.0-6000"
54
+ "@docusaurus/module-type-aliases": "0.0.0-6003"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^18.0.0",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=18.0"
62
62
  },
63
- "gitHead": "10f44ae468ae6751fa53eb8af6441265f0e5075c"
63
+ "gitHead": "d4d8bd2115a51f595d7b9133f32b3ba0571c8c02"
64
64
  }
@@ -5,11 +5,20 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import {useContextualSearchFilters} from '@docusaurus/theme-common';
8
+ import {DEFAULT_SEARCH_TAG} from '@docusaurus/theme-common/internal';
9
+ import {useDocsContextualSearchTags} from '@docusaurus/plugin-content-docs/client';
10
+ import useDocusaurusContext from '@docusaurus/core/src/client/exports/useDocusaurusContext';
9
11
 
10
- // Translate search-engine agnostic search filters to Algolia search filters
12
+ function useSearchTags() {
13
+ // only docs have custom search tags per version
14
+ const docsTags = useDocsContextualSearchTags();
15
+ return [DEFAULT_SEARCH_TAG, ...docsTags];
16
+ }
17
+
18
+ // Translate search-engine agnostic search tags to Algolia search filters
11
19
  export function useAlgoliaContextualFacetFilters(): [string, string[]] {
12
- const {locale, tags} = useContextualSearchFilters();
20
+ const locale = useDocusaurusContext().i18n.currentLocale;
21
+ const tags = useSearchTags();
13
22
 
14
23
  // Seems safe to convert locale->language, see AlgoliaSearchMetadata comment
15
24
  const languageFilter = `language:${locale}`;