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

# 搜索高亮

> 返回与查询相关的段落，而不是普通的网站描述

搜索高亮会将每个结果原本普通的网站描述替换为页面中与您的查询相关的段落。它们在 `/v2/search` 上默认启用；无需额外的参数、输出格式或 `scrapeOptions`。

搜索高亮会保留搜索结果的 URL、标题、位置和排名。对于网页结果，高亮文本会在 `description` 中返回；对于新闻结果，则会在 `snippet` 中返回。

<Note>
  如果 Firecrawl 无法为某个结果生成搜索高亮，则会保留该网站原本的普通描述或 `snippet`。单个页面不可用不会影响返回其他搜索结果。
</Note>

<div id="highlights-are-enabled-by-default">
  ## 默认启用 搜索高亮
</div>

正常使用 Search 即可；当有相关页面内容可用时，Firecrawl 会返回 搜索高亮。

<CodeGroup>
  ```python Python theme={null}
  from firecrawl import Firecrawl

  firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")

  results = firecrawl.search(
      query="how does firecrawl handle javascript rendering",
      limit=5,
  )

  for result in results.web or []:
      print(result.description)
  ```

  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: 'fc-YOUR-API-KEY' });

  const results = await firecrawl.search(
    'how does firecrawl handle javascript rendering',
    {
      limit: 5,
    }
  );

  for (const result of results.web ?? []) {
    console.log(result.description);
  }
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.firecrawl.dev/v2/search \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "how does firecrawl handle javascript rendering",
      "limit": 5
    }'
  ```

  ```bash CLI theme={null}
  firecrawl search "how does firecrawl handle javascript rendering" \
    --limit 5
  ```
</CodeGroup>

<div id="mcp">
  ### MCP
</div>

`firecrawl_search` MCP 工具默认也会返回 搜索高亮：

```json MCP theme={null}
{
  "query": "how does firecrawl handle javascript rendering",
  "limit": 5
}
```

<div id="response">
  ## 响应
</div>

搜索高亮 沿用现有的描述字段，因此响应结构与普通搜索响应相同。

````json theme={null}
{
  "success": true,
  "data": {
    "web": [
      {
        "url": "https://www.firecrawl.dev/blog/javascript-web-scraping",
        "title": "Web Scraping With JavaScript: Step-by-Step Guide",
        "description": "# Web Scraping With JavaScript: Step-by-Step Guide\n## When should you use scraping APIs instead of DIY tools?\n### Setting up Firecrawl\n```\nnpm install firecrawl\n```\n\n```\nFIRECRAWL_API_KEY=fc-your-api-key-here\n```\n\n### Solving the JavaScript quotes problem\nYou describe what you want, and Firecrawl handles extraction and validation.",
        "position": 1
      }
    ]
  }
}
````

如果相关页面内容包含标题、列表、表格或代码，搜索高亮 可能会包含 Markdown。若要保留这种结构，请将该字段按 Markdown 渲染或处理。

<div id="disable-highlights">
  ## 禁用搜索高亮
</div>

如果你想返回每个网站的纯文本描述或 snippet 片段，而不是 `highlights`，请将 `highlights` 设为 `false`。

<CodeGroup>
  ```python Python theme={null}
  results = firecrawl.search(
      query="Firecrawl search API",
      highlights=False,
  )
  ```

  ```js Node theme={null}
  const results = await firecrawl.search('Firecrawl search API', {
    highlights: false,
  });
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.firecrawl.dev/v2/search \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "Firecrawl search API",
      "highlights": false
    }'
  ```

  ```bash CLI theme={null}
  firecrawl search "Firecrawl search API" --no-highlights
  ```
</CodeGroup>

<div id="behavior-by-result-type">
  ## 按结果类型划分的行为
</div>

* **网页：** 在可用时，会用与查询相关的页面内容替换 `description`。
* **新闻：** 在可用时，会用与查询相关的页面内容替换 `snippet`。
* **图像：** 图像结果将原样返回。
* **带抓取的搜索：** `highlights` 会影响搜索结果中的 description 或 snippet。通过 `scrapeOptions` 请求的内容会单独返回，不会被替换。
* **Zero Data Retention：** ZDR 搜索会保留网站原本的 description 和 snippet。

有关 Search 的所有参数及完整的响应 schema，请参见 [Search API reference](/zh/api-reference/endpoint/search)。
