# 搜索日志应忽略 OpenSearch 占位符术语并可选地标记 AI-agent 搜索

**URL:** https://meta.discourse.org/t/search-logs-should-ignore-opensearch-placeholder-terms-and-optionally-tag-ai-agent-searches/395393
**Category:** Feature
**Tags:** search, dashboard-reports
**Created:** [2026 年2 月 6 日 18:56 UTC](https://meta.discourse.org/t/search-logs-should-ignore-opensearch-placeholder-terms-and-optionally-tag-ai-agent-searches/395393 "2026-02-06T18:56:57Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![TheBaby5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thebaby5/32/178897_2.png) [@TheBaby5](https://meta.discourse.org/u/TheBaby5)
#### Post date: [2026 年2 月 6 日 18:56 UTC](https://meta.discourse.org/t/search-logs-should-ignore-opensearch-placeholder-terms-and-optionally-tag-ai-agent-searches/395393/1 "2026-02-06T18:56:57Z")

</div>

## 摘要

**热门搜索词** 报告被 OpenSearch 的 URL 模板占位符（例如 `{searchTerms}`）污染，这些占位符并非真实的搜索。这使得仪表板具有误导性（通常显示 `{searchTerms}` 为点击率 (CTR) 为 0% 的“热门搜索词”）。

此外，随着人工智能介导的浏览的增长，最好能够选择性地在搜索分析中将 **由人工智能代理发起的搜索单独标记** 。

* * *

## 问题 1：SearchLog 中存在 OpenSearch 占位符噪音

在我的网站上，`{searchTerms}` 显示为 **排名第一的热门搜索词** ，有数千条记录，点击率 (CTR) 为 0%。这些记录来自爬虫/机器人（例如 Googlebot、Bingbot 等）抓取 `/opensearch.xml` 并使用字面占位符字符串而不是真实查询来调用搜索端点。

这之前被讨论过：

- [https://meta.discourse.org/t/what-is-the-search-term-string-in-search-results/175908](https://meta.discourse.org/t/what-is-the-search-term-string-in-search-results/175908)

但占位符术语仍然显示在分析中。

* * *

## 重现步骤

1. 为网站启用/提供 OpenSearch（例如 `/opensearch.xml`）
2. 允许爬虫访问它（默认公共行为）
3. 等待爬虫获取 OpenSearch 模板并命中搜索端点
4. 查看 **管理 → 报告 → 热门搜索词**
5. 观察到 `{searchTerms}` 等占位符值主导报告

* * *

## 预期行为

OpenSearch 客户端使用的占位符/模板字符串 **不应** 被记录为真实搜索，并且 **不应** 出现在热门搜索词中。

* * *

## 实际行为

占位符字符串（例如 `{searchTerms}`）被保存到 `SearchLog` 中，并显示为真实的搜索词，从而污染了分析数据。

* * *

## 建议的修复方法

在记录到 `SearchLog` 之前，过滤掉已知的 OpenSearch 占位符字符串，例如：

- `{searchTerms}`
- `{search_term_string}`

（如果有其他常见的变体，添加它们也是可以的。）

这实际上是“机器人噪音”，绝不可能是合法的用户查询，它破坏了报告的可用性。

* * *

## 更大的机会：AI 时代的搜索分析（可选/中长期）

`{searchTerms}` 问题凸显了一个更广泛的差距：越来越多的搜索是由 **代表用户的 AI 代理** 发起的（例如，当用户要求助手“在此论坛中搜索 X”时）。这些搜索可能代表真实的用户意图，但目前它们与其他所有流量混在一起，难以理解。

### 中期（可选）

使用 `User-Agent` 启发式方法标记可能由 AI 代理发起的搜索（仅举例）：

- ChatGPT 浏览/代理 UA 变体
- Perplexity 机器人
- 与 Claude 相关的代理
- 谷歌 AI 相关的 UA（例如 `GoogleOther` 等）

这不需要完美——只要能让管理员获得可见性就足够了。

### 长期（可选）

在 **热门搜索词** 报告中添加“AI 搜索”过滤器/选项卡，以便管理员可以查看：

- 人工搜索
- AI 代理搜索
- 所有组合

* * *

## 为什么这很重要

- 占位符污染使仪表板的可信度降低，并可能主导“热门”榜单
- 管理员不应手动清理分析数据或忽略错误的置顶条目
- AI 介导的搜索流量正在增加，网站所有者可以从了解这些意图中受益

---

_[View the full topic](https://meta.discourse.org/t/search-logs-should-ignore-opensearch-placeholder-terms-and-optionally-tag-ai-agent-searches/395393)._
