Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 9 additions & 32 deletions docs/_components/search/SearchBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ export default {
// Store the search words into localStorage
localStorage.setItem('search-words', val.toLowerCase());
this.sendEvent();
let ids = this.index.search({
query: val.toLowerCase(),
index: ['content'],
limit: 1000,
});
let ids = this.index.search(val.toLowerCase(), { limit: 1000 });
this.found = ids.length;

// Cut the results array down to 100 rows
Expand Down Expand Up @@ -181,35 +177,16 @@ export default {
this.index = new FlexSearch.Index({
tokenize: 'full',
});
let cfg,
ctx,
map,
reg = undefined;

// flexsearch 0.8.x uses different export format: 1.map.json, 1.reg.json
// Use relative paths - works for dev, serve, and production since files are in public/
let mapData, regData;
// console.log('buildIndex() MODE', import.meta.env.MODE);
if (import.meta.env.MODE === 'development') {
cfg = await axios.get(`/indexes/${name}/cfg.json`);
ctx = await axios.get(`/indexes/${name}/ctx.json`);
map = await axios.get(`/indexes/${name}/map.json`);
reg = await axios.get(`/indexes/${name}/reg.json`);
} else {
cfg = await axios.get(
`https://raw.githubusercontent.com/api3dao/airnode-docs/main/docs/public/indexes/${name}/cfg.json`
);
ctx = await axios.get(
`https://raw.githubusercontent.com/api3dao/airnode-docs/main/docs/public/indexes/${name}/ctx.json`
);
map = await axios.get(
`https://raw.githubusercontent.com/api3dao/airnode-docs/main/docs/public/indexes/${name}/map.json`
);
reg = await axios.get(
`https://raw.githubusercontent.com/api3dao/airnode-docs/main/docs/public/indexes/${name}/reg.json`
);
}
mapData = await axios.get(`/indexes/${name}/1.map.json`);
regData = await axios.get(`/indexes/${name}/1.reg.json`);

this.index.import('cfg', cfg.data);
this.index.import('ctx', ctx.data);
this.index.import('map', map.data);
this.index.import('reg', reg.data);
this.index.import('1.map', mapData.data);
this.index.import('1.reg', regData.data);
this.isIndexLoaded = true;
},
},
Expand Down
1 change: 1 addition & 0 deletions docs/public/indexes/all-dev/1.map.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/public/indexes/all-dev/1.reg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341]
1 change: 0 additions & 1 deletion docs/public/indexes/all-dev/cfg.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all-dev/ctx.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all-dev/map.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all-dev/reg.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/public/indexes/all/1.map.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/public/indexes/all/1.reg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334]
1 change: 0 additions & 1 deletion docs/public/indexes/all/cfg.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all/ctx.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all/map.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/all/reg.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/public/indexes/latest/1.map.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/public/indexes/latest/1.reg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,328,329,330,331,332,333,334]
1 change: 0 additions & 1 deletion docs/public/indexes/latest/cfg.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/latest/ctx.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/latest/map.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/public/indexes/latest/reg.json

This file was deleted.

32 changes: 6 additions & 26 deletions libs/flexTestSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ const retrieveIndexAll = () => {
withFileTypes: true,
})
.filter((item) => !item.isDirectory())
.map((item) => item.name.slice(0, -5));
.filter((item) => item.name.endsWith('.json') && !item.name.startsWith('.'))
.map((item) => item.name.slice(0, -5)); // Remove .json extension

// Need to filter the array since Apple likes to add a hidden file ".DS_"
keys = keys.filter(filterKeys);
function filterKeys(key) {
return ['cfg', 'ctx', 'map', 'reg'].includes(key);
}
console.log('retrieveIndexAll keys array', keys);

for (let i = 0, key; i < keys.length; i += 1) {
Expand All @@ -42,13 +38,9 @@ const retrieveIndexLatest = () => {
withFileTypes: true,
})
.filter((item) => !item.isDirectory())
.map((item) => item.name.slice(0, -5));
.filter((item) => item.name.endsWith('.json') && !item.name.startsWith('.'))
.map((item) => item.name.slice(0, -5)); // Remove .json extension

// Need to filter the array since Apple likes to add a hidden file ".DS_"
keys = keys.filter(filterKeys);
function filterKeys(key) {
return ['cfg', 'ctx', 'map', 'reg'].includes(key);
}
console.log('retrieveIndexLatest keys array', keys);

for (let i = 0, key; i < keys.length; i += 1) {
Expand All @@ -66,13 +58,7 @@ const retrieveIndexLatest = () => {
*/
function searchIndexAll() {
const query = 'gateway';
let ids = indexAll.search({
query: query,
index: ['content'],
limit: 100,
suggest: false,
bool: 'and',
});
let ids = indexAll.search(query, { limit: 100 });
console.log('----- indexAll -----');
console.log(`Found "${query}" in (${ids.length}) pages.`);
console.log('ids', ids);
Expand All @@ -87,13 +73,7 @@ function searchIndexAll() {
*/
function searchIndexLatest() {
const query = 'gateway';
let ids = indexLatest.search({
query: query,
index: ['content'],
limit: 100,
suggest: false,
bool: 'and',
});
let ids = indexLatest.search(query, { limit: 100 });
console.log('----- indexLatest -----');
console.log(`Found "${query}" in (${ids.length}) pages.`);
console.log('ids', ids);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
"diff": "^8.0.3",
"ethers": "^6.16.0",
"file": "^0.2.2",
"flexsearch": "~0.7.43",
"flexsearch": "~0.8.212",
"fs-extra": "^11.3.3",
"gray-matter": "^4.0.3",
"html-dom-parser": "^5.1.2",
"husky": "^9.1.7",
"js-yaml": "^4.1.1",
"medium-zoom": "^1.1.0",
"oust": "^2.0.4",
"prettier": "^3.7.4",
"prettier": "^3.8.1",
"tiny-emitter": "^2.1.0",
"vitepress": "1.6.4",
"walk-sync": "^4.0.1"
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.