@easyops-cn/docusaurus-search-local 0.44.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,13 @@
|
|
|
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
|
+
|
|
5
12
|
## [0.44.0](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.43.0...v0.44.0) (2024-06-06)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
+
matchedPaths.push(path);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
for (const matchedPath of
|
|
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 (
|
|
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);
|