@easyops-cn/docusaurus-search-local 0.43.0 → 0.44.1

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.44.1](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.44.0...v0.44.1) (2024-06-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix searching within context closes [#424](https://github.com/easyops-cn/docusaurus-search-local/issues/424) ([bbec667](https://github.com/easyops-cn/docusaurus-search-local/commit/bbec66782d6a285338211248f14b4d1d0e5eee50))
11
+
12
+ ## [0.44.0](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.43.0...v0.44.0) (2024-06-06)
13
+
14
+
15
+ ### Features
16
+
17
+ * add more translate to locales ([#417](https://github.com/easyops-cn/docusaurus-search-local/issues/417)) ([0ee814b](https://github.com/easyops-cn/docusaurus-search-local/commit/0ee814b4f4e320ec6a672bef1e04ee6bbe6ba10b))
18
+
5
19
  ## [0.43.0](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.42.0...v0.43.0) (2024-06-05)
6
20
 
7
21
 
@@ -128,13 +128,13 @@ export default function SearchBar({ handleSearchBarToggle, }) {
128
128
  if (useAllContextsWithNoSearchContext && isEmpty) {
129
129
  linkText = translate({
130
130
  id: "theme.SearchBar.seeAllOutsideContext",
131
- message: "See results outside {context}",
131
+ message: 'See all results outside "{context}"',
132
132
  }, { context: translatedSearchContext });
133
133
  }
134
134
  else {
135
135
  linkText = translate({
136
136
  id: "theme.SearchBar.searchInContext",
137
- message: "See all results in {context}",
137
+ message: 'See all results within "{context}"',
138
138
  }, { context: translatedSearchContext });
139
139
  }
140
140
  }
@@ -2,6 +2,8 @@
2
2
  "theme.SearchBar.label": "Suche",
3
3
  "theme.SearchBar.seeAll": "Alle Ergebnisse anzeigen",
4
4
  "theme.SearchBar.noResultsText": "Keine Ergebnisse",
5
+ "theme.SearchBar.searchInContext": "Alle Ergebnisse innerhalb von \"{context}\" anzeigen",
6
+ "theme.SearchBar.seeAllOutsideContext": "Alle Ergebnisse außerhalb von \"{context}\" anzeigen",
5
7
  "theme.SearchPage.existingResultsTitle": "Suchergebnisse für \"{query}\"",
6
8
  "theme.SearchPage.emptyResultsTitle": "Suche in der Dokumentation",
7
9
  "theme.SearchPage.documentsFound.plurals": "1 Dokument gefunden|{count} Dokumente gefunden",
@@ -2,7 +2,9 @@
2
2
  "theme.SearchBar.label": "Tìm kiếm...",
3
3
  "theme.SearchBar.seeAll": "Xem tất cả kết quả được tìm thấy",
4
4
  "theme.SearchBar.noResultsText": "Không tìm thấy kết quả nào",
5
- "theme.SearchPage.existingResultsTitle": "Tìm kiếm theo tiêu đề: {query}",
5
+ "theme.SearchBar.searchInContext": "Xem tất cả kết quả bên trong \"{context}\"",
6
+ "theme.SearchBar.seeAllOutsideContext": "Xem tất cả kết quả bên ngoài \"{context}\"",
7
+ "theme.SearchPage.existingResultsTitle": "Tìm kiếm theo tiêu đề: \"{query}\"",
6
8
  "theme.SearchPage.emptyResultsTitle": "Tìm kiếm theo tiêu đề",
7
9
  "theme.SearchPage.documentsFound.plurals": "Có {count} kết quả được tìm thấy",
8
10
  "theme.SearchPage.noResultsText": "Không tìm thấy kết quả nào",
@@ -2,7 +2,9 @@
2
2
  "theme.SearchBar.label": "搜索",
3
3
  "theme.SearchBar.seeAll": "查看全部结果",
4
4
  "theme.SearchBar.noResultsText": "没有找到任何文档",
5
- "theme.SearchPage.existingResultsTitle": "{query}” 的搜索结果",
5
+ "theme.SearchBar.searchInContext": "查看“{context}”以内的全部结果",
6
+ "theme.SearchBar.seeAllOutsideContext": "查看“{context}”以外的全部结果",
7
+ "theme.SearchPage.existingResultsTitle": "“{query}”的搜索结果",
6
8
  "theme.SearchPage.emptyResultsTitle": "搜索文档",
7
9
  "theme.SearchPage.documentsFound.plurals": "共找到 {count} 篇文档",
8
10
  "theme.SearchPage.noResultsText": "没有找到任何文档",
@@ -22,7 +22,11 @@ function buildIndex(allDocuments, { language, removeDefaultStopWordFilter, remov
22
22
  if (language.length > 1) {
23
23
  require("lunr-languages/lunr.multi")(lunr_1.default);
24
24
  }
25
- return allDocuments.map((documents) => ({
25
+ // Some documents may be empty (unset array item), which is not mapped.
26
+ return new Array(allDocuments.length)
27
+ .fill(null)
28
+ .map((_doc, index) => { var _a; return (_a = allDocuments[index]) !== null && _a !== void 0 ? _a : []; })
29
+ .map((documents) => ({
26
30
  documents,
27
31
  index: (0, lunr_1.default)(function () {
28
32
  if (language.length > 1) {
@@ -34,17 +34,17 @@ function postBuildFactory(config, searchIndexFilename) {
34
34
  for (const doc of documents) {
35
35
  if (doc.u.startsWith(baseUrl)) {
36
36
  const uri = doc.u.substring(baseUrl.length);
37
- let matchedPathes = [];
37
+ const matchedPaths = [];
38
38
  for (const _path of searchContextByPaths) {
39
39
  const path = typeof _path === "string" ? _path : _path.path;
40
40
  if (uri === path || uri.startsWith(`${path}/`)) {
41
- matchedPathes.push(path);
41
+ matchedPaths.push(path);
42
42
  }
43
43
  }
44
- for (const matchedPath of matchedPathes) {
44
+ for (const matchedPath of matchedPaths) {
45
45
  let dirAllDocs = docsByDirMap.get(matchedPath);
46
46
  if (!dirAllDocs) {
47
- dirAllDocs = [];
47
+ dirAllDocs = new Array(allDocuments.length);
48
48
  docsByDirMap.set(matchedPath, dirAllDocs);
49
49
  }
50
50
  let dirDocs = dirAllDocs[docIndex];
@@ -53,7 +53,8 @@ function postBuildFactory(config, searchIndexFilename) {
53
53
  }
54
54
  dirDocs.push(doc);
55
55
  }
56
- if (matchedPathes.length > 0 && !useAllContextsWithNoSearchContext) {
56
+ if (matchedPaths.length > 0 &&
57
+ !useAllContextsWithNoSearchContext) {
57
58
  continue;
58
59
  }
59
60
  }
@@ -61,12 +62,6 @@ function postBuildFactory(config, searchIndexFilename) {
61
62
  }
62
63
  docIndex++;
63
64
  }
64
- for (const [k, v] of docsByDirMap) {
65
- const docsNotEmpty = v.filter((d) => !!d);
66
- if (docsNotEmpty.length < v.length) {
67
- docsByDirMap.set(k, docsNotEmpty);
68
- }
69
- }
70
65
  }
71
66
  else {
72
67
  docsByDirMap.set("", allDocuments);
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@easyops-cn/docusaurus-search-local",
3
- "version": "0.43.0",
3
+ "version": "0.44.1",
4
4
  "description": "An offline/local search plugin for Docusaurus v3",
5
- "repository": "https://github.com/easyops-cn/docusaurus-search-local",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/easyops-cn/docusaurus-search-local",
8
+ "directory": "packages/docusaurus-search-local"
9
+ },
6
10
  "homepage": "https://github.com/easyops-cn/docusaurus-search-local",
7
11
  "scripts": {
8
12
  "start": "concurrently -k -n client,server,types \"yarn run start:client\" \"yarn run start:server\" \"yarn run start:types\"",