This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e4965ff87a [refactor](next) fix search result (#3663)
5e4965ff87a is described below

commit 5e4965ff87aca3e08e7a77f07f11e9b78d8eab74
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Sun May 17 15:59:58 2026 -0700

    [refactor](next) fix search result (#3663)
---
 docs/getting-started/what-is-apache-doris.md       |   6 --
 i18n/zh-CN/code.json                               |   8 +-
 .../getting-started/what-is-apache-doris.md        |   6 --
 .../getting-started/what-is-apache-doris.md        |   6 --
 src/theme/DocBreadcrumbs/index.tsx                 |  19 +++-
 src/theme/DocVersionBanner/index.tsx               | 101 ++++++++++++---------
 src/theme/SearchBar/SearchBar.jsx                  |  37 +++++---
 .../getting-started/what-is-apache-doris.md        |   6 --
 8 files changed, 101 insertions(+), 88 deletions(-)

diff --git a/docs/getting-started/what-is-apache-doris.md 
b/docs/getting-started/what-is-apache-doris.md
index dd231652000..74195a88b1a 100644
--- a/docs/getting-started/what-is-apache-doris.md
+++ b/docs/getting-started/what-is-apache-doris.md
@@ -152,10 +152,4 @@ Apache Doris integrates deeply with mainstream data 
ecosystems.
 
 ## Community and Contribution
 
-Apache Doris originated from Baidu's advertising reporting business (the Palo 
project). It was open-sourced in 2017, donated to the Apache Software 
Foundation for incubation in 2018, and **officially became an Apache Top-Level 
Project in June 2022**.
-
-- **Contributor scale**: 700+ contributors, with 120+ monthly active 
contributors.
-- **User coverage**: 10,000+ enterprise users worldwide.
-- **Cloud vendor support**: AWS, Azure, GCP, Alibaba Cloud, Tencent Cloud, 
Huawei Cloud, Volcano Engine, and more.
-
 You are welcome to join the community: 
https://doris.apache.org/community/join-community
diff --git a/i18n/zh-CN/code.json b/i18n/zh-CN/code.json
index f4cdee60e34..ab98f26312f 100644
--- a/i18n/zh-CN/code.json
+++ b/i18n/zh-CN/code.json
@@ -68,13 +68,7 @@
         "description": "archive latest version"
     },
     "theme.docs.versions.latestVersionSuggestionLabel": {
-        "message": "使用参考请跳转至 {recommondVersionLink} 或 {latestVersionLink} 
正式版本文档进行查阅。"
-    },
-    "theme.docs.versions.latestVersionLinkLabel": {
-        "message": "3.x"
-    },
-    "theme.docs.versions.recommondVersionLinkLabel": {
-        "message": "2.1"
+        "message": "使用参考请跳转至 {v4xLink}/{v3xLink}/{v21Link} 正式版本文档进行查阅。"
     },
     "theme.docs.versions.unreleasedVersionLabel": {
         "message": "此处为 Apache Doris {unreleased}的版本文档,不建议作为使用参考。"
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/getting-started/what-is-apache-doris.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/getting-started/what-is-apache-doris.md
index 151617c9416..184a2bc562b 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/getting-started/what-is-apache-doris.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/getting-started/what-is-apache-doris.md
@@ -152,10 +152,4 @@ Apache Doris 与主流数据生态深度集成。
 
 ## 社区与贡献
 
-Apache Doris 起源于百度广告报表业务(Palo 项目),2017 年开源,2018 年捐赠 Apache 基金会孵化,**2022 年 6 
月正式成为 Apache 顶级项目**。
-
-- **贡献者规模**:700+ 贡献者,120+ 月活贡献者。
-- **用户覆盖**:全球 10000+ 企业用户。
-- **云厂商支持**:AWS、Azure、GCP、阿里云、腾讯云、华为云、火山云等。
-
 欢迎加入社区建设:https://doris.apache.org/community/join-community
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/getting-started/what-is-apache-doris.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/getting-started/what-is-apache-doris.md
index 151617c9416..184a2bc562b 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/getting-started/what-is-apache-doris.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/getting-started/what-is-apache-doris.md
@@ -152,10 +152,4 @@ Apache Doris 与主流数据生态深度集成。
 
 ## 社区与贡献
 
-Apache Doris 起源于百度广告报表业务(Palo 项目),2017 年开源,2018 年捐赠 Apache 基金会孵化,**2022 年 6 
月正式成为 Apache 顶级项目**。
-
-- **贡献者规模**:700+ 贡献者,120+ 月活贡献者。
-- **用户覆盖**:全球 10000+ 企业用户。
-- **云厂商支持**:AWS、Azure、GCP、阿里云、腾讯云、华为云、火山云等。
-
 欢迎加入社区建设:https://doris.apache.org/community/join-community
diff --git a/src/theme/DocBreadcrumbs/index.tsx 
b/src/theme/DocBreadcrumbs/index.tsx
index ffdc9a2f2d7..86bc2553d48 100644
--- a/src/theme/DocBreadcrumbs/index.tsx
+++ b/src/theme/DocBreadcrumbs/index.tsx
@@ -1,7 +1,10 @@
 import React from 'react';
 import clsx from 'clsx';
 import { ThemeClassNames } from '@docusaurus/theme-common';
-import { useSidebarBreadcrumbs } from '@docusaurus/plugin-content-docs/client';
+import {
+    useSidebarBreadcrumbs,
+    useActivePluginAndVersion,
+} from '@docusaurus/plugin-content-docs/client';
 import { useHomePageRoute } from '@docusaurus/theme-common/internal';
 import Link from '@docusaurus/Link';
 import { translate } from '@docusaurus/Translate';
@@ -66,12 +69,15 @@ function BreadcrumbsItem({
 export default function DocBreadcrumbs(): JSX.Element | null {
     const breadcrumbs = useSidebarBreadcrumbs();
     const homePageRoute = useHomePageRoute();
+    const activePluginAndVersion = useActivePluginAndVersion();
     if (!breadcrumbs) {
         return null;
     }
     // Drop the top-level sidebar section group (e.g. "Get Started"),
     // since it's a visual grouping and has no destination page.
     const visibleBreadcrumbs = breadcrumbs.length > 1 ? breadcrumbs.slice(1) : 
breadcrumbs;
+    const activeVersion = activePluginAndVersion?.activeVersion;
+    const versionMainDocPath = activeVersion?.docs.find(doc => doc.id === 
activeVersion.mainDocId)?.path;
     return (
         <nav
             className={clsx(ThemeClassNames.docs.docBreadcrumbs, 
styles.breadcrumbsContainer)}
@@ -83,6 +89,17 @@ export default function DocBreadcrumbs(): JSX.Element | null 
{
         >
             <ul className="breadcrumbs" itemScope 
itemType="https://schema.org/BreadcrumbList";>
                 {homePageRoute && <HomeBreadcrumbItem />}
+                {activeVersion && (
+                    <li className="breadcrumbs__item">
+                        {versionMainDocPath ? (
+                            <Link className="breadcrumbs__link" 
href={versionMainDocPath}>
+                                {activeVersion.label}
+                            </Link>
+                        ) : (
+                            <span 
className="breadcrumbs__link">{activeVersion.label}</span>
+                        )}
+                    </li>
+                )}
                 {visibleBreadcrumbs.map((item, idx) => {
                     const isLast = idx === visibleBreadcrumbs.length - 1;
                     const href =
diff --git a/src/theme/DocVersionBanner/index.tsx 
b/src/theme/DocVersionBanner/index.tsx
index 3ae671c3f28..764a3f16f82 100644
--- a/src/theme/DocVersionBanner/index.tsx
+++ b/src/theme/DocVersionBanner/index.tsx
@@ -3,7 +3,13 @@ import clsx from 'clsx';
 import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
 import Link from '@docusaurus/Link';
 import Translate from '@docusaurus/Translate';
-import { useActivePlugin, useDocVersionSuggestions, type GlobalVersion } from 
'@docusaurus/plugin-content-docs/client';
+import {
+    useActivePlugin,
+    useActiveDocContext,
+    useDocVersionSuggestions,
+    useVersions,
+    type GlobalVersion,
+} from '@docusaurus/plugin-content-docs/client';
 import { ThemeClassNames } from '@docusaurus/theme-common';
 import { useDocsPreferredVersion, useDocsVersion } from 
'@docusaurus/plugin-content-docs/client';
 import type { Props } from '@theme/DocVersionBanner';
@@ -59,53 +65,46 @@ function BannerLabel(props: BannerLabelComponentProps) {
     return <BannerLabelComponent {...props} />;
 }
 
-function LatestVersionSuggestionLabel({
-    versionLabel,
-    to,
-    realLatestVersion,
+function VersionsSuggestionLabel({
+    v4xTo,
+    v3xTo,
+    v21To,
     onClick,
 }: {
-    to: string;
+    v4xTo: string;
+    v3xTo: string;
+    v21To: string;
     onClick: () => void;
-    realLatestVersion: {
-        label: string;
-        to: string;
-    };
-    versionLabel: string;
 }) {
     return (
         <Translate
             id="theme.docs.versions.latestVersionSuggestionLabel"
             description="The label used to tell the user to check the latest 
version"
             values={{
-                latestVersionLink: (
+                v4xLink: (
+                    <b>
+                        <Link to={v4xTo} onClick={onClick}>
+                            4.x
+                        </Link>
+                    </b>
+                ),
+                v3xLink: (
                     <b>
-                        <Link to={realLatestVersion.to} onClick={onClick}>
-                            <Translate
-                                id="theme.docs.versions.latestVersionLinkLabel"
-                                description="The label used for the latest 
version suggestion link label"
-                            >
-                                Version 3.x
-                            </Translate>
+                        <Link to={v3xTo} onClick={onClick}>
+                            3.x
                         </Link>
                     </b>
                 ),
-                recommondVersionLink: (
+                v21Link: (
                     <b>
-                        <Link to={to} onClick={onClick}>
-                            <Translate
-                                
id="theme.docs.versions.recommondVersionLinkLabel"
-                                description="The label used for the 
recommended version suggestion link label"
-                            >
-                                Version 2.1
-                            </Translate>
+                        <Link to={v21To} onClick={onClick}>
+                            2.1
                         </Link>
                     </b>
                 ),
             }}
         >
-            {/* 'For up-to-date documentation, see the {latestVersionLink} 
({versionLabel}).' */}
-            {'For usage, please refer to the official documentation of  
{recommondVersionLink} or {latestVersionLink}.'}
+            {'For usage, please refer to the official documentation of Version 
{v4xLink}/{v3xLink}/{v21Link}'}
         </Translate>
     );
 }
@@ -124,12 +123,20 @@ function DocVersionBannerEnabled({
     const getVersionMainDoc = (version: GlobalVersion) => 
version.docs.find(doc => doc.id === version.mainDocId)!;
 
     const { savePreferredVersionName } = useDocsPreferredVersion(pluginId);
+    const { latestVersionSuggestion } = useDocVersionSuggestions(pluginId);
+    const { alternateDocVersions } = useActiveDocContext(pluginId);
+    const versions = useVersions(pluginId);
 
-    const { latestDocSuggestion, latestVersionSuggestion } = 
useDocVersionSuggestions(pluginId);
+    const resolveDocPath = (versionName: string): string => {
+        const alt = alternateDocVersions[versionName];
+        if (alt) return alt.path;
+        const version = versions.find(v => v.name === versionName);
+        return version ? getVersionMainDoc(version).path : '/';
+    };
 
-    // Try to link to same doc in latest version (not always possible), falling
-    // back to main doc of latest version
-    const latestVersionSuggestedDoc = latestDocSuggestion ?? 
getVersionMainDoc(latestVersionSuggestion);
+    const v4xTo = resolveDocPath('4.x');
+    const v3xTo = resolveDocPath('3.x');
+    const v21To = resolveDocPath('2.1');
 
     return (
         <div
@@ -140,13 +147,10 @@ function DocVersionBannerEnabled({
                 <BannerLabel siteTitle={siteTitle} 
versionMetadata={versionMetadata} />
             </div>
             <div className="margin-top--md">
-                <LatestVersionSuggestionLabel
-                    versionLabel={latestVersionSuggestion.label}
-                    to={latestVersionSuggestedDoc.path}
-                    realLatestVersion={{
-                        label: '3.x',
-                        to: '/docs/3.x/gettingStarted/what-is-apache-doris',
-                    }}
+                <VersionsSuggestionLabel
+                    v4xTo={v4xTo}
+                    v3xTo={v3xTo}
+                    v21To={v21To}
                     onClick={() => 
savePreferredVersionName(latestVersionSuggestion.name)}
                 />
             </div>
@@ -156,8 +160,19 @@ function DocVersionBannerEnabled({
 
 export default function DocVersionBanner({ className }: Props): 
React.ReactElement | null {
     const versionMetadata = useDocsVersion();
-    if (versionMetadata.banner) {
-        return <DocVersionBannerEnabled className={className} 
versionMetadata={versionMetadata} />;
+    const activePlugin = useActivePlugin();
+    const activeDocContext = useActiveDocContext(activePlugin?.pluginId);
+
+    if (!versionMetadata.banner) {
+        return null;
     }
-    return null;
+
+    // Hide the banner on docs under `docs/key-features/` — their doc ids
+    // start with `key-features/` (Docusaurus derives the id from the file
+    // path relative to the docs root).
+    if (activeDocContext.activeDoc?.id.startsWith('key-features/')) {
+        return null;
+    }
+
+    return <DocVersionBannerEnabled className={className} 
versionMetadata={versionMetadata} />;
 }
diff --git a/src/theme/SearchBar/SearchBar.jsx 
b/src/theme/SearchBar/SearchBar.jsx
index 0a7dfad7074..4fc41010bbe 100644
--- a/src/theme/SearchBar/SearchBar.jsx
+++ b/src/theme/SearchBar/SearchBar.jsx
@@ -118,27 +118,38 @@ export default function SearchBar({ handleSearchBarToggle 
}) {
             return;
         }
         let nextSearchContext = '';
-        if (location.pathname.startsWith(versionUrl)) {
-            const uri = location.pathname.substring(versionUrl.length);
-            let matchedPath;
-            for (const _path of searchContextByPaths) {
-                const path = typeof _path === 'string' ? _path : _path.path;
-                if (uri === path || uri.startsWith(`${path}/`)) {
-                    matchedPath = path;
-                    break;
-                }
-            }
-            if (matchedPath) {
-                nextSearchContext = matchedPath;
+        // searchContextByPaths is expressed relative to the docs root
+        // (e.g. ['docs']), so we must strip both the locale prefix and the
+        // /docs/<version>/ version segment before matching. Subtracting
+        // versionUrl from the raw pathname is not enough: for a non-default
+        // version page the leftover starts with the doc slug (e.g.
+        // 'data-operate/...') and never matches 'docs', leaving searchContext
+        // empty and fetching the no-context index (which is empty when
+        // useAllContextsWithNoSearchContext is false).
+        const normalized = normalizePathname(location.pathname, locales);
+        const parts = normalized.replace(/^\//, '').split('/').filter(Boolean);
+        if (parts[0] === 'docs' && parts.length > 1 && 
VERSIONS.includes(parts[1])) {
+            parts.splice(1, 1);
+        }
+        const uri = parts.join('/');
+        let matchedPath;
+        for (const _path of searchContextByPaths) {
+            const path = typeof _path === 'string' ? _path : _path.path;
+            if (uri === path || uri.startsWith(`${path}/`)) {
+                matchedPath = path;
+                break;
             }
         }
+        if (matchedPath) {
+            nextSearchContext = matchedPath;
+        }
         if (prevSearchContext.current !== nextSearchContext) {
             // Reset index state map once search context is changed.
             indexStateMap.current.delete(nextSearchContext);
             prevSearchContext.current = nextSearchContext;
         }
         setSearchContext(nextSearchContext);
-    }, [location.pathname, versionUrl]);
+    }, [location.pathname, locales]);
     const hidden = !!hideSearchBarWithNoSearchContext && 
Array.isArray(searchContextByPaths) && searchContext === '';
 
     const loadIndex = useCallback(
diff --git a/versioned_docs/version-4.x/getting-started/what-is-apache-doris.md 
b/versioned_docs/version-4.x/getting-started/what-is-apache-doris.md
index dd231652000..74195a88b1a 100644
--- a/versioned_docs/version-4.x/getting-started/what-is-apache-doris.md
+++ b/versioned_docs/version-4.x/getting-started/what-is-apache-doris.md
@@ -152,10 +152,4 @@ Apache Doris integrates deeply with mainstream data 
ecosystems.
 
 ## Community and Contribution
 
-Apache Doris originated from Baidu's advertising reporting business (the Palo 
project). It was open-sourced in 2017, donated to the Apache Software 
Foundation for incubation in 2018, and **officially became an Apache Top-Level 
Project in June 2022**.
-
-- **Contributor scale**: 700+ contributors, with 120+ monthly active 
contributors.
-- **User coverage**: 10,000+ enterprise users worldwide.
-- **Cloud vendor support**: AWS, Azure, GCP, Alibaba Cloud, Tencent Cloud, 
Huawei Cloud, Volcano Engine, and more.
-
 You are welcome to join the community: 
https://doris.apache.org/community/join-community


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to