Skip to content

fix: url for fetch extra source file #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 27, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/707.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
url for fetch extra source file
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"logo": "ansys",
"search_extra_sources": {
"PyDPF Core": "https:/dpf.docs.pyansys.com/version/stable/",
"PyAnsys": "https://docs.pyansys.com/version/stable/",
"Actions": "https://actions.docs.ansys.com/version/stable/",
},
"search_filters": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,17 @@ function openDB(name = "search-cache", version = 1) {
*/
async function getFromIDB(key) {
const db = await openDB();
console.log(`Retrieving from IndexedDB with key: ${key}`);

return new Promise((resolve, reject) => {
const transaction = db.transaction("indexes", "readonly");
const store = transaction.objectStore("indexes");
const request = store.get(key);

request.onsuccess = () => {
console.log("Retrieved from IndexedDB:", request.result);
resolve(request.result);
};

request.onerror = () => {
console.error("Failed to retrieve from IndexedDB:", request.error);
reject(request.error);
};
});
Expand All @@ -74,15 +71,13 @@ async function getFromIDB(key) {
*/
async function saveToIDB(key, value) {
const db = await openDB();
console.log(`Saving to IndexedDB with key: ${key}`, value);

return new Promise((resolve, reject) => {
const transaction = db.transaction("indexes", "readwrite");
const store = transaction.objectStore("indexes");
const request = store.put(value, key);

request.onsuccess = () => {
console.log("Saved to IndexedDB successfully");
resolve(true);
};

Expand Down Expand Up @@ -136,8 +131,8 @@ require(["fuse"], function (Fuse) {

if (!libData) {
const libPath = EXTRA_SOURCES[lib];
const libJsonPath = `${libPath}/_static/search.json`;
const res = await fetch(libJsonPath);
const url = `${libPath}/_static/search.json`;
const res = await fetch(url);
libData = await res.json();
await saveToIDB(cacheKey, libData);
}
Expand Down Expand Up @@ -464,7 +459,6 @@ require(["fuse"], function (Fuse) {
const handleSearchInput = debounce(
() => {
const query = document.getElementById("search-input").value.trim();
console.log("Search query:", query);
if (query.length > 0) {
performSearch();
}
Expand Down
Loading