Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Feb 18, 2024
1 parent 76ed76a commit 3c700ea
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bd504f8c
cb0b1116
4 changes: 2 additions & 2 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.549">
<meta name="generator" content="quarto-1.4.550">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down Expand Up @@ -677,7 +677,7 @@ <h2 class="anchored" data-anchor-id="citation">Citation</h2>
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="./pages/github_api_call.html" class="pagination-link aria-label=" github="" api="" call"="">
<a href="./pages/github_api_call.html" class="pagination-link" aria-label="GitHub API call">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">GitHub API call</span>
</a>
</div>
Expand Down
10 changes: 5 additions & 5 deletions index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pages/github_api_call.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.549">
<meta name="generator" content="quarto-1.4.550">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand Down Expand Up @@ -740,7 +740,7 @@ <h2 class="anchored" data-anchor-id="example-usage">Example Usage</h2>
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="../index.html" class="pagination-link aria-label=" homepage"="">
<a href="../index.html" class="pagination-link" aria-label="Homepage">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Homepage</span>
</a>
</div>
Expand Down
114 changes: 57 additions & 57 deletions search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site_libs/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

65 changes: 52 additions & 13 deletions site_libs/quarto-search/quarto-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,18 @@ function showCopyLink(query, options) {
// create the index
var fuseIndex = undefined;
var shownWarning = false;

// fuse index options
const kFuseIndexOptions = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};

async function readSearchData() {
// Initialize the search index on demand
if (fuseIndex === undefined) {
Expand All @@ -685,17 +697,7 @@ async function readSearchData() {
shownWarning = true;
return;
}
// create fuse index
const options = {
keys: [
{ name: "title", weight: 20 },
{ name: "section", weight: 20 },
{ name: "text", weight: 10 },
],
ignoreLocation: true,
threshold: 0.1,
};
const fuse = new window.Fuse([], options);
const fuse = new window.Fuse([], kFuseIndexOptions);

// fetch the main search.json
const response = await fetch(offsetURL("search.json"));
Expand Down Expand Up @@ -1226,8 +1228,34 @@ function algoliaSearch(query, limit, algoliaOptions) {
});
}

function fuseSearch(query, fuse, fuseOptions) {
return fuse.search(query, fuseOptions).map((result) => {
let subSearchTerm = undefined;
let subSearchFuse = undefined;
const kFuseMaxWait = 125;

async function fuseSearch(query, fuse, fuseOptions) {
let index = fuse;
// Fuse.js using the Bitap algorithm for text matching which runs in
// O(nm) time (no matter the structure of the text). In our case this
// means that long search terms mixed with large index gets very slow
//
// This injects a subIndex that will be used once the terms get long enough
// Usually making this subindex is cheap since there will typically be
// a subset of results matching the existing query
if (subSearchFuse !== undefined && query.startsWith(subSearchTerm)) {
// Use the existing subSearchFuse
index = subSearchFuse;
} else if (subSearchFuse !== undefined) {
// The term changed, discard the existing fuse
subSearchFuse = undefined;
subSearchTerm = undefined;
}

// Search using the active fuse
const then = performance.now();
const resultsRaw = await index.search(query, fuseOptions);
const now = performance.now();

const results = resultsRaw.map((result) => {
const addParam = (url, name, value) => {
const anchorParts = url.split("#");
const baseUrl = anchorParts[0];
Expand All @@ -1244,4 +1272,15 @@ function fuseSearch(query, fuse, fuseOptions) {
crumbs: result.item.crumbs,
};
});

// If we don't have a subfuse and the query is long enough, go ahead
// and create a subfuse to use for subsequent queries
if (now - then > kFuseMaxWait && subSearchFuse === undefined) {
subSearchTerm = query;
subSearchFuse = new window.Fuse([], kFuseIndexOptions);
resultsRaw.forEach((rr) => {
subSearchFuse.add(rr.item);
});
}
return results;
}
10 changes: 5 additions & 5 deletions sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://nhs-pycom.github.io/opensource-health-statistics/about.html</loc>
<lastmod>2024-02-11T00:37:37.337Z</lastmod>
<loc>https://nhs-pycom.github.io/opensource-health-statistics/index.html</loc>
<lastmod>2024-02-18T00:37:01.736Z</lastmod>
</url>
<url>
<loc>https://nhs-pycom.github.io/opensource-health-statistics/pages/github_api_call.html</loc>
<lastmod>2024-02-11T00:37:37.337Z</lastmod>
<lastmod>2024-02-18T00:37:01.736Z</lastmod>
</url>
<url>
<loc>https://nhs-pycom.github.io/opensource-health-statistics/index.html</loc>
<lastmod>2024-02-11T00:37:37.337Z</lastmod>
<loc>https://nhs-pycom.github.io/opensource-health-statistics/about.html</loc>
<lastmod>2024-02-18T00:37:01.736Z</lastmod>
</url>
</urlset>

0 comments on commit 3c700ea

Please sign in to comment.