From 24b938f46b0e787a8234778269fe341462f1b7ba Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 23 Jul 2026 11:56:47 +0200 Subject: [PATCH 1/8] Add static search to isolated documentation builds Generate a Pagefind index at build time so standalone sites can provide search without requiring a backend service. Co-Authored-By: Claude Sonnet 4.6 (1M context) Co-authored-by: Cursor --- NOTICE.txt | 23 ++++ docs/_docset.yml | 1 + docs/configure/content-set/index.md | 17 +++ .../Builder/ConfigurationFile.cs | 2 + .../Builder/FeatureFlags.cs | 6 + .../Toc/DocumentationSetFile.cs | 2 + .../Assets/config.ts | 2 + .../Assets/web-components/Header/Header.tsx | 126 ++++++++++------- .../ModalSearch/ModalSearch.test.tsx | 12 ++ .../ModalSearch/ModalSearch.tsx | 5 +- .../ModalSearch/pagefind.test.ts | 50 +++++++ .../web-components/ModalSearch/pagefind.ts | 106 ++++++++++++++ .../ModalSearch/useModalSearchQuery.ts | 20 ++- .../Elastic.Documentation.Site.csproj | 15 ++ .../Scripts/package-pagefind.mjs | 34 +++++ src/Elastic.Documentation.Site/_ViewModels.cs | 13 +- .../package-lock.json | 130 ++++++++++++++++-- src/Elastic.Documentation.Site/package.json | 1 + src/Elastic.Markdown/_Layout.cshtml | 2 +- .../IsolatedBuildService.cs | 18 ++- .../PagefindSearchIndexer.cs | 99 +++++++++++++ .../docs-builder/Http/DocumentationWebHost.cs | 2 + .../Http/ReloadableGeneratorState.cs | 1 + .../DocumentationSetFileTests.cs | 2 + .../FeatureFlagsTests.cs | 30 ++++ 25 files changed, 650 insertions(+), 69 deletions(-) create mode 100644 src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.test.ts create mode 100644 src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts create mode 100644 src/Elastic.Documentation.Site/Scripts/package-pagefind.mjs create mode 100644 src/services/Elastic.Documentation.Isolated/PagefindSearchIndexer.cs create mode 100644 tests/Elastic.Documentation.Configuration.Tests/FeatureFlagsTests.cs diff --git a/NOTICE.txt b/NOTICE.txt index 9547245cfc..0a230b0236 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -26,6 +26,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +License notice for Pagefind (v1.5.2) +----------------------------------- +Copyright 2022 Pagefind + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + License notice for Errata (v0.13.0) ------------------------------------ MIT License diff --git a/docs/_docset.yml b/docs/_docset.yml index 33dfda75e4..c9a4ff76c3 100644 --- a/docs/_docset.yml +++ b/docs/_docset.yml @@ -40,6 +40,7 @@ subs: features: primary-nav: false + static-search: true # Temporarily disabled: the pr-272388 preview registry artifact is gone and there is no # working `main` registry to fall back to yet. Re-enable once a registry URL resolves. diff --git a/docs/configure/content-set/index.md b/docs/configure/content-set/index.md index a8fea4a311..7cc9411eac 100644 --- a/docs/configure/content-set/index.md +++ b/docs/configure/content-set/index.md @@ -13,6 +13,23 @@ A content set in `docs-builder` is equivalent to an AsciiDoc book. At this level | **Content source files** --> A whole bunch of markup files as well as any other assets used in the docs (for example, images, videos, and diagrams). | **Markup**: AsciiDoc files **Assets**: Images, videos, and diagrams | **Markup**: MD files **Assets**: Images, videos, and diagrams | | **Information architecture** --> A way to specify the order in which these text-based files should appear in the information architecture of the book. | `index.asciidoc` file (this can be spread across several AsciiDoc files, but generally starts with the index file specified in the `conf.yaml` file)) | `docset.yml` and/or `toc.yml` file(s) | +## Enable static search + +Isolated builds can include a Pagefind index that runs entirely in the browser. Enable it in `docset.yml`: + +```yaml +features: + static-search: true +``` + +The generated site needs to be served over HTTP, such as from S3 and CloudFront or a local static server: + +```sh +python3 -m http.server --directory .artifacts/docs/html +``` + +Static search does not require a search API, but it does not work in the on-demand `docs-builder serve` mode or when pages are opened directly with `file://`. + ## Learn more * [File structure](./file-structure.md). diff --git a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs index 34db8d3ea0..aaa9c84006 100644 --- a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs +++ b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs @@ -313,6 +313,8 @@ public ConfigurationFile(DocumentationSetFile docSetFile, IDocumentationSetConte _features["primary-nav"] = docSetFile.Features.PrimaryNav.Value; if (docSetFile.Features.DisableGithubEditLink.HasValue) _features["disable-github-edit-link"] = docSetFile.Features.DisableGithubEditLink.Value; + if (docSetFile.Features.StaticSearch.HasValue) + _features["static-search"] = docSetFile.Features.StaticSearch.Value; // primary-nav requires the Elastic global navigation which is not available for white-label builds if (Branding is not null && docSetFile.Features.PrimaryNav is true) diff --git a/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs b/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs index 00ecf4fc53..917143312d 100644 --- a/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs +++ b/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs @@ -38,6 +38,12 @@ public bool WebsiteSearchEnabled set => _featureFlags["website-search"] = value; } + public bool StaticSearchEnabled + { + get => IsEnabled("static-search"); + set => _featureFlags["static-search"] = value; + } + public string? WebsiteSearchScriptUrl { get; set; } public bool AirGappedEnabled diff --git a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs index 5ea875eb28..41e00716df 100644 --- a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs +++ b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs @@ -756,6 +756,8 @@ public class DocumentationSetFeatures public bool? PrimaryNav { get; set; } [YamlMember(Alias = "disable-github-edit-link", ApplyNamingConventions = false)] public bool? DisableGithubEditLink { get; set; } + [YamlMember(Alias = "static-search", ApplyNamingConventions = false)] + public bool? StaticSearch { get; set; } } [YamlSerializable] diff --git a/src/Elastic.Documentation.Site/Assets/config.ts b/src/Elastic.Documentation.Site/Assets/config.ts index 1ac157be94..e9fc45392f 100644 --- a/src/Elastic.Documentation.Site/Assets/config.ts +++ b/src/Elastic.Documentation.Site/Assets/config.ts @@ -11,6 +11,7 @@ export interface DocsConfig { rootPath: string // '/docs' for assembler, '' for codex and isolated apiBasePath: string // '/docs/_api' for assembler, '/api' for codex airGapped: boolean + staticSearch: boolean } declare global { @@ -26,6 +27,7 @@ const DEFAULT_CONFIG: DocsConfig = { rootPath: '', apiBasePath: '/docs/_api', airGapped: false, + staticSearch: false, } export const config: DocsConfig = window.__DOCS_CONFIG__ ?? DEFAULT_CONFIG diff --git a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx index b4a65df6b0..8e29ed9438 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx @@ -1,5 +1,8 @@ +import { config } from '../../config' import '../../eui-icons-cache' +import { ModalSearch } from '../ModalSearch/ModalSearch' import { useHtmxContainer } from '../shared/htmx/useHtmxContainer' +import { sharedQueryClient } from '../shared/queryClient' import { DeploymentInfo, headerButtonCss } from './DeploymentInfo' import { EuiHeader, @@ -10,6 +13,7 @@ import { } from '@elastic/eui' import { css } from '@emotion/react' import r2wc from '@r2wc/react-to-web-component' +import { QueryClientProvider } from '@tanstack/react-query' import { useRef } from 'react' interface Props { @@ -158,56 +162,78 @@ export const Header = ({ ` return ( - - - - GitHub - , - ] - : []), - , - ], - }, - ] - : []), - ]} - /> - + + + + + , + ], + }, + ] + : []), + ...(!airGapped + ? [ + { + items: [ + ...(githubLink + ? [ + + + GitHub + , + ] + : []), + , + ], + }, + ] + : []), + ]} + /> + + ) } diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.test.tsx b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.test.tsx index 815c66fd36..f8691ec242 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.test.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.test.tsx @@ -71,4 +71,16 @@ describe('ModalSearch', () => { screen.queryByRole('button', { name: 'Close search modal' }) ).not.toBeInTheDocument() }) + + it('does not offer Ask AI in an isolated build', () => { + renderModalSearch() + + act(() => { + modalSearchStore.getState().actions.openModal() + modalSearchStore.getState().actions.setSearchTerm('logging') + }) + + expect(screen.queryByText('Ask AI Assistant')).not.toBeInTheDocument() + expect(screen.queryByText('Tell me more about')).not.toBeInTheDocument() + }) }) diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.tsx b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.tsx index 9a3168e12e..3674449aca 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/ModalSearch.tsx @@ -1,3 +1,4 @@ +import { config } from '../../config' import '../../eui-icons-cache' import { ElasticAiAssistantButton } from '../AskAi/ElasticAiAssistantButton' import { InfoBanner } from '../AskAi/InfoBanner' @@ -209,7 +210,7 @@ const ModalSearchContent = ({ {} - {searchTerm && ( + {config.buildType !== 'isolated' && searchTerm && (
)} - + {config.buildType !== 'isolated' && }
) diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.test.ts b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.test.ts new file mode 100644 index 0000000000..c96ff510c7 --- /dev/null +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.test.ts @@ -0,0 +1,50 @@ +import { mapPagefindResults } from './pagefind' + +describe('mapPagefindResults', () => { + it('maps matching sections into modal results', () => { + const results = mapPagefindResults([ + { + score: 0.9, + data: { + url: '/guide/', + excerpt: 'Guide excerpt', + meta: { title: 'Guide' }, + sub_results: [ + { + title: 'Install', + url: '/guide/#install', + excerpt: 'Run the installer', + }, + ], + }, + }, + ]) + + expect(results).toEqual([ + { + type: 'docs', + url: '/guide/#install', + title: 'Install', + description: 'Run the installer', + score: 0.9, + parents: [], + }, + ]) + }) + + it('falls back to page metadata when no sections are returned', () => { + const [result] = mapPagefindResults([ + { + score: 0.5, + data: { + url: '/guide/', + excerpt: 'Guide excerpt', + meta: { title: 'Guide' }, + }, + }, + ]) + + expect(result.title).toBe('Guide') + expect(result.description).toBe('Guide excerpt') + }) +}) diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts new file mode 100644 index 0000000000..18c8491aba --- /dev/null +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts @@ -0,0 +1,106 @@ +import { config } from '../../config' + +interface PagefindResultData { + url: string + excerpt: string + meta: { + title?: string + } + sub_results?: Array<{ + title: string + url: string + excerpt: string + }> +} + +interface PagefindRawResult { + score: number + data: () => Promise +} + +interface PagefindSearch { + results: PagefindRawResult[] +} + +interface PagefindApi { + options: (options: { baseUrl: string; basePath: string }) => Promise + init: () => Promise + search: (query: string) => Promise +} + +export interface StaticSearchResult { + type: 'docs' + url: string + title: string + description: string + score: number + parents: Array<{ url: string; title: string }> +} + +export interface PagefindLoadedResult { + score: number + data: PagefindResultData +} + +let pagefindPromise: Promise | undefined + +const rootPath = config.rootPath.replace(/\/$/, '') + +const loadPagefind = () => { + pagefindPromise ??= (async () => { + try { + const moduleUrl = `${rootPath}/pagefind/pagefind.js` + const pagefind = (await import(moduleUrl)) as PagefindApi + await pagefind.options({ + baseUrl: rootPath || '/', + basePath: `${rootPath}/pagefind/`, + }) + await pagefind.init() + return pagefind + } catch (error) { + pagefindPromise = undefined + throw error + } + })() + return pagefindPromise +} + +export const searchPagefind = async ( + query: string +): Promise => { + const pagefind = await loadPagefind() + const search = await pagefind.search(query) + if (!search) return [] + + const pages = await Promise.all( + search.results.slice(0, 20).map(async (result) => ({ + score: result.score, + data: await result.data(), + })) + ) + + return mapPagefindResults(pages) +} + +export const mapPagefindResults = ( + pages: PagefindLoadedResult[] +): StaticSearchResult[] => + pages.map(({ score, data }) => { + const section = data.sub_results?.find(({ url }) => + url.includes('#') + ) ?? + data.sub_results?.[0] ?? { + title: data.meta.title ?? data.url, + url: data.url, + excerpt: data.excerpt, + } + + return { + type: 'docs' as const, + url: section.url, + title: section.title || data.meta.title || data.url, + description: section.excerpt, + score, + parents: [], + } + }) diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts index d6422f389f..b4e454a1b1 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts @@ -21,6 +21,7 @@ import { } from '../shared/errorHandling' import { ApiError } from '../shared/errorHandling' import { usePageNumber, useSearchTerm } from './modalSearch.store' +import { searchPagefind } from './pagefind' import { keepPreviousData, useQuery, @@ -85,12 +86,14 @@ export const useModalSearchQuery = () => { !!trimmedSearchTerm && trimmedSearchTerm.length >= 1 && !isCooldownActive && - !awaitingNewInput + !awaitingNewInput && + (config.buildType !== 'isolated' || config.staticSearch) const query = useQuery({ queryKey: [ 'modal-search', { + buildType: config.buildType, searchTerm: debouncedSearchTerm.toLowerCase(), pageNumber, }, @@ -106,6 +109,20 @@ export const useModalSearchQuery = () => { }) } + if (config.buildType === 'isolated') { + const results = await searchPagefind(debouncedSearchTerm) + if (signal.aborted) + throw new DOMException('Aborted', 'AbortError') + + return SearchResponse.parse({ + results: results.slice(0, 20), + totalResults: results.length, + pageCount: results.length > 0 ? 1 : 0, + pageNumber: 1, + pageSize: 20, + }) + } + return traceSpan('modal_search', async (span) => { span.setAttribute( ATTR_NAVIGATION_SEARCH_QUERY, @@ -167,6 +184,7 @@ export const useModalSearchQuery = () => { queryKey: [ 'modal-search', { + buildType: config.buildType, searchTerm: debouncedSearchTerm.toLowerCase(), pageNumber, }, diff --git a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj index 5a9d1c2ae4..1316622364 100644 --- a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj +++ b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj @@ -86,6 +86,21 @@ + + + + + + + + A whole bunch of markup files as well as any other assets used in the docs (for example, images, videos, and diagrams). | **Markup**: AsciiDoc files **Assets**: Images, videos, and diagrams | **Markup**: MD files **Assets**: Images, videos, and diagrams | | **Information architecture** --> A way to specify the order in which these text-based files should appear in the information architecture of the book. | `index.asciidoc` file (this can be spread across several AsciiDoc files, but generally starts with the index file specified in the `conf.yaml` file)) | `docset.yml` and/or `toc.yml` file(s) | -## Enable static search +## Static search -Isolated builds can include a Pagefind index that runs entirely in the browser. Enable it in `docset.yml`: +Isolated builds and `docs-builder serve` automatically include a [Pagefind](https://pagefind.app) search index that runs entirely in the browser. No configuration is needed — the `pagefind` exporter is included by default. -```yaml -features: - static-search: true -``` - -The generated site needs to be served over HTTP, such as from S3 and CloudFront or a local static server: +To use it with a static build, serve the output over HTTP: ```sh python3 -m http.server --directory .artifacts/docs/html ``` -Static search does not require a search API, but it does not work in the on-demand `docs-builder serve` mode or when pages are opened directly with `file://`. +Static search does not require a search API. It does not work when pages are opened directly with `file://`. ## Learn more diff --git a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs index aaa9c84006..34db8d3ea0 100644 --- a/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs +++ b/src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs @@ -313,8 +313,6 @@ public ConfigurationFile(DocumentationSetFile docSetFile, IDocumentationSetConte _features["primary-nav"] = docSetFile.Features.PrimaryNav.Value; if (docSetFile.Features.DisableGithubEditLink.HasValue) _features["disable-github-edit-link"] = docSetFile.Features.DisableGithubEditLink.Value; - if (docSetFile.Features.StaticSearch.HasValue) - _features["static-search"] = docSetFile.Features.StaticSearch.Value; // primary-nav requires the Elastic global navigation which is not available for white-label builds if (Branding is not null && docSetFile.Features.PrimaryNav is true) diff --git a/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs b/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs index 917143312d..00ecf4fc53 100644 --- a/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs +++ b/src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs @@ -38,12 +38,6 @@ public bool WebsiteSearchEnabled set => _featureFlags["website-search"] = value; } - public bool StaticSearchEnabled - { - get => IsEnabled("static-search"); - set => _featureFlags["static-search"] = value; - } - public string? WebsiteSearchScriptUrl { get; set; } public bool AirGappedEnabled diff --git a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs index 41e00716df..5ea875eb28 100644 --- a/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs +++ b/src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs @@ -756,8 +756,6 @@ public class DocumentationSetFeatures public bool? PrimaryNav { get; set; } [YamlMember(Alias = "disable-github-edit-link", ApplyNamingConventions = false)] public bool? DisableGithubEditLink { get; set; } - [YamlMember(Alias = "static-search", ApplyNamingConventions = false)] - public bool? StaticSearch { get; set; } } [YamlSerializable] diff --git a/src/Elastic.Documentation.Site/Assets/config.ts b/src/Elastic.Documentation.Site/Assets/config.ts index e9fc45392f..1ac157be94 100644 --- a/src/Elastic.Documentation.Site/Assets/config.ts +++ b/src/Elastic.Documentation.Site/Assets/config.ts @@ -11,7 +11,6 @@ export interface DocsConfig { rootPath: string // '/docs' for assembler, '' for codex and isolated apiBasePath: string // '/docs/_api' for assembler, '/api' for codex airGapped: boolean - staticSearch: boolean } declare global { @@ -27,7 +26,6 @@ const DEFAULT_CONFIG: DocsConfig = { rootPath: '', apiBasePath: '/docs/_api', airGapped: false, - staticSearch: false, } export const config: DocsConfig = window.__DOCS_CONFIG__ ?? DEFAULT_CONFIG diff --git a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx index b6ae3caf5e..6a61547317 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx +++ b/src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx @@ -173,7 +173,7 @@ export const Header = ({ { items: [logoSection], }, - ...(config.staticSearch + ...(config.buildType === 'isolated' ? [ { items: [ diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts index a356630611..46883c3563 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/pagefind.ts @@ -52,11 +52,11 @@ const rootPath = config.rootPath.replace(/\/$/, '') const loadPagefind = () => { pagefindPromise ??= (async () => { try { - const moduleUrl = `${rootPath}/pagefind/pagefind.js` + const moduleUrl = `${rootPath}/_static/pagefind/pagefind.js` const pagefind = (await import(moduleUrl)) as PagefindApi await pagefind.options({ baseUrl: rootPath || '/', - basePath: `${rootPath}/pagefind/`, + basePath: `${rootPath}/_static/pagefind/`, }) await pagefind.init() return pagefind diff --git a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts index 6cb6c1397d..1ca23e633b 100644 --- a/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts +++ b/src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts @@ -87,7 +87,7 @@ export const useModalSearchQuery = () => { trimmedSearchTerm.length >= 1 && !isCooldownActive && !awaitingNewInput && - (config.buildType !== 'isolated' || config.staticSearch) + true const query = useQuery({ queryKey: [ diff --git a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj index 1316622364..5a9d1c2ae4 100644 --- a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj +++ b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj @@ -86,21 +86,6 @@ - - - - - - - -