> ## Documentation Index
> Fetch the complete documentation index at: https://ophel.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 全局搜索 — 统一检索大纲、会话、提示词与设置

> 使用默认快捷键打开全局搜索叠加层，支持 type:、folder:、tag:、is:、level:、date: 等语法过滤，搜索当前上下文中的内容。

export const ShortcutLegend = ({lang = "en"}) => {
  const isZh = lang === "zh";
  return <div className="ophel-shortcut-legend" role="note">
      <div className="ophel-shortcut-legend-title">
        {isZh ? "跨平台按键说明" : "Cross-platform key mapping"}
      </div>
      <div className="ophel-shortcut-legend-body">
        {isZh ? <>
            文档中的快捷键会同时显示 Windows/Linux 与 Mac 写法：
            <code>Ctrl</code> 对应 <code>Command</code>，
            <code>Alt</code> 对应 <code>Option</code>。唯一例外是提示词发送，
            <code>Ctrl+Enter</code> 在 Mac 上也使用 <code>Ctrl+Enter</code>。
          </> : <>
            Shortcuts show both Windows/Linux and Mac keys: <code>Ctrl</code> maps
            to <code>Command</code>, and <code>Alt</code> maps to
            <code>Option</code>. Prompt submit is the only exception:
            <code>Ctrl+Enter</code> remains <code>Ctrl+Enter</code> on Mac.
          </>}
      </div>
    </div>;
};

export const Shortcut = ({combo, mac, sameOnMac = false}) => {
  const keyLabels = {
    arrowup: {
      win: "Up",
      mac: "↑"
    },
    arrowdown: {
      win: "Down",
      mac: "↓"
    },
    arrowleft: {
      win: "Left",
      mac: "←"
    },
    arrowright: {
      win: "Right",
      mac: "→"
    },
    up: {
      win: "Up",
      mac: "↑"
    },
    down: {
      win: "Down",
      mac: "↓"
    },
    left: {
      win: "Left",
      mac: "←"
    },
    right: {
      win: "Right",
      mac: "→"
    },
    esc: {
      win: "Esc",
      mac: "Esc"
    },
    escape: {
      win: "Esc",
      mac: "Esc"
    },
    enter: {
      win: "Enter",
      mac: "Enter"
    },
    shift: {
      win: "Shift",
      mac: "⇧"
    },
    backslash: {
      win: "\\",
      mac: "\\"
    }
  };
  const modifierLabels = {
    ctrl: {
      win: "Ctrl",
      mac: "⌘"
    },
    control: {
      win: "Ctrl",
      mac: "⌘"
    },
    cmd: {
      win: "Ctrl",
      mac: "⌘"
    },
    command: {
      win: "Ctrl",
      mac: "⌘"
    },
    alt: {
      win: "Alt",
      mac: "⌥"
    },
    option: {
      win: "Alt",
      mac: "⌥"
    },
    shift: {
      win: "Shift",
      mac: "⇧"
    }
  };
  const normalizeToken = token => String(token || "").trim();
  const formatKey = (token, platform) => {
    const normalized = normalizeToken(token);
    const key = normalized.toLowerCase();
    const mapped = keyLabels[key];
    if (mapped) return mapped[platform];
    if (normalized.length === 1) return normalized.toUpperCase();
    return normalized;
  };
  const formatCombo = (value, platform) => String(value || "").split("+").map(normalizeToken).filter(Boolean).map(token => {
    const mapped = modifierLabels[token.toLowerCase()];
    return mapped ? mapped[platform] : formatKey(token, platform);
  }).join(platform === "mac" ? "" : "+");
  const windowsLabel = formatCombo(combo, "win");
  const macLabel = sameOnMac ? windowsLabel : mac || formatCombo(combo, "mac");
  const title = windowsLabel === macLabel ? windowsLabel : `Windows/Linux: ${windowsLabel}; Mac: ${macLabel}`;
  return <span className="ophel-shortcut" title={title}>
      <code>{windowsLabel}</code>
      {windowsLabel !== macLabel && <>
          <span className="ophel-shortcut-separator"> / </span>
          <code>{macLabel}</code>
        </>}
    </span>;
};

export const Icon = ({src, alt}) => <img src={typeof window !== "undefined" && typeof src === "string" && src.startsWith("/images/icons/") && (window.location.pathname === "/docs" || window.location.pathname.startsWith("/docs/")) ? `/docs${src}` : src} alt={alt} width="18" height="18" style={{
  display: "inline-block",
  verticalAlign: "-0.2em",
  margin: "0 0.15em"
}} />;

<img src="https://mintcdn.com/urzeye/9I8m8P8gSndxcYtq/images/enhancements/global-search-zh.png?fit=max&auto=format&n=9I8m8P8gSndxcYtq&q=85&s=63aabf19907c35bd242b7aed9867d7f6" alt="全局搜索叠加层 — 搜索框与分类结果" width="1280" height="800" data-path="images/enhancements/global-search-zh.png" />

按 <Icon src="/docs/images/icons/keyboard.svg" alt="快捷键图标" /> <Shortcut combo="ctrl+k" />，或点击浮动按钮组中的 <Icon src="/docs/images/icons/search.svg" alt="搜索图标" /> 搜索图标，打开全局搜索叠加层。它把当前上下文中的大纲节点、当前 AI 平台或账号的历史对话、提示词词库和设置项统一纳入一个搜索框，无需逐个标签翻找。

## 搜索范围

| 类型                                                          | 说明                            |
| ----------------------------------------------------------- | ----------------------------- |
| <Icon src="/docs/images/icons/outline.svg" alt="大纲图标" /> 大纲节点    | 当前对话中所有标题与你的提问                |
| <Icon src="/docs/images/icons/conversation.svg" alt="会话图标" /> 会话 | 当前 AI 平台或账号的历史对话（按标题、标签、文件夹）  |
| <Icon src="/docs/images/icons/prompt.svg" alt="提示词图标" /> 提示词     | 提示词库中的标题和内容                   |
| <Icon src="/docs/images/icons/settings.svg" alt="设置图标" /> 设置项    | 设置页面中的功能名称和关键词                |
| <Icon src="/docs/images/icons/features.svg" alt="功能提示图标" /> 功能提示 | Ophel 功能发现小贴士 — 输入 `tip:` 可浏览 |

搜索结果按类别分组显示，用方向键上下导航，按 Enter 跳转，Esc 关闭。

## 语法过滤

在搜索框中使用以下前缀，可以精确限制结果范围。多个过滤条件可以相互组合，也可以和普通关键词一起使用。

| 语法          | 作用范围   | 可用值                                                  | 示例                   |
| ----------- | ------ | ---------------------------------------------------- | -------------------- |
| `type:类型`   | 全部     | `outline` · `conversations` · `prompts` · `settings` | `type:conversations` |
| `folder:名称` | 会话     | 任意文件夹名（模糊匹配）                                         | `folder:工作`          |
| `tag:名称`    | 会话、提示词 | 任意标签名（模糊匹配）                                          | `tag:研究`             |
| `is:状态`     | 会话     | `pinned`（已置顶）· `unpinned`（未置顶）                       | `is:pinned`          |
| `level:层级`  | 大纲节点   | `0` – `6`（标题深度）                                      | `level:2`            |
| `date:天数`   | 会话、提示词 | `Nd`，最大 999 天，如 `7d`、`30d`                           | `date:30d`           |

<Note>
  在搜索框中输入 `tip:`
  可进入功能提示模式。这不是语法过滤条件——它会跳过普通搜索，直接列出 Ophel
  功能发现小贴士。
</Note>

例如：

```text theme={}
folder:工作 tag:研究 模型
```

这会找到「工作」文件夹中带「研究」标签、且标题包含「模型」的会话。

## 模糊搜索

开启模糊搜索后，Ophel 允许不完全匹配——搜索 `rans` 也能找到 `translate`。关闭后只返回精确子串匹配。

在 **设置 → 全局搜索** 中开关此选项。

<Tip>
  如果你想精确定位某个变量名或已知标题，建议关闭模糊搜索，避免噪音结果。
</Tip>

## 提示词搜索的插入行为

在搜索结果中选中一条**提示词**后按 Enter，默认行为随场景智能切换：

* 如果当前页面有可用的输入框，直接将提示词插入输入框
* 否则，跳转到提示词所在的标签页并高亮显示

可在 **设置 → 全局搜索** 中将此行为改为"仅定位"（只跳转高亮，不插入）。

## 触发方式

| 触发方式                                                                              | 说明                           |
| --------------------------------------------------------------------------------- | ---------------------------- |
| <Icon src="/docs/images/icons/keyboard.svg" alt="快捷键图标" /> <Shortcut combo="ctrl+k" /> | 默认快捷键                        |
| <Icon src="/docs/images/icons/search.svg" alt="搜索图标" /> 浮动按钮                           | 点击浮动快捷按钮组中的搜索图标              |
| 双击 Shift                                                                          | 可选，在设置中开启；不同于其他快捷键，此触发无需聚焦页面 |

## 搜索技巧

<AccordionGroup>
  <Accordion title="按文件夹查找会话">
    输入 `folder:` 加上文件夹名的一部分。开启模糊搜索后不需要输入完整名称。

    ```text theme={}
    folder:客户
    ```
  </Accordion>

  <Accordion title="按标签查找会话">
    输入 `tag:` 加上标签名。

    ```text theme={}
    tag:待办
    ```
  </Accordion>

  <Accordion title="按置顶状态过滤">
    输入 `is:pinned` 只看已置顶会话，或 `is:unpinned` 排除置顶会话。

    ```text theme={}
    is:pinned 项目
    ```
  </Accordion>

  <Accordion title="按时间过滤">
    输入 `date:Nd` 将结果限制在最近 N 天内更新的会话或提示词。例如 `date:7d` 返回最近一周的内容。

    ```text theme={}
    date:30d 重构
    ```
  </Accordion>

  <Accordion title="按标题层级过滤大纲节点">
    输入 `level:n`（0–6）查找指定深度的大纲节点。Level 1 对应 `<h1>`，Level 2 对应 `<h2>`，以此类推。Level 0 匹配你自己的提问。

    ```text theme={}
    level:2 概述
    ```
  </Accordion>

  <Accordion title="跳转到设置项">
    直接输入功能名称或关键词。例如输入「主题」会出现外观设置入口，输入「快捷键」会出现快捷键设置页面。
  </Accordion>

  <Accordion title="在当前对话中查找大纲标题">
    阅读对话时打开全局搜索，输入标题的一部分。选中结果后页面会滚动到该位置，并在大纲中高亮对应节点。
  </Accordion>
</AccordionGroup>

## 相关设置

**设置 → 全局搜索**：

| 设置项          | 说明                                 |
| ------------ | ---------------------------------- |
| 双击 Shift     | 是否启用双击 Shift 触发搜索（适合不方便使用默认快捷键的场景） |
| 模糊搜索         | 开启后允许不完全匹配，搜索"转" 也能找到"翻转"等词        |
| 提示词 Enter 行为 | 选中提示词结果后按 Enter 的动作：智能插入或仅定位       |
