mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
5f973a3aca
Generated-By: mintlify-agent Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
67 lines
2.1 KiB
Plaintext
67 lines
2.1 KiB
Plaintext
---
|
|
title: "搜索加权"
|
|
description: "通过在页面 frontmatter 或 `docs.json` 导航中设置数值加权乘数,使你的文档站点内置搜索的排名向特定页面或章节倾斜。"
|
|
keywords: ["搜索排名", "搜索加权", "加权", "搜索优先级"]
|
|
---
|
|
|
|
使用 `boost` 让特定页面或章节在站内搜索中获得更高的排名权重。该值是一个应用于每个内容片段相关性得分的数值乘数:`boost: 3` 会使某个片段的相关性提升为没有加权时的三倍。
|
|
|
|
`boost` 仅影响 Mintlify 托管的文档站点上的搜索栏。它不会改变外部搜索引擎对你页面的索引方式。
|
|
|
|
<div id="boost-a-single-page">
|
|
## 为单个页面加权
|
|
</div>
|
|
|
|
在页面的 [frontmatter](/zh/organize/pages) 中设置 `boost`,可放大其搜索排名。
|
|
|
|
```mdx
|
|
---
|
|
title: "Custom domain"
|
|
description: "Connect your custom domain to your Mintlify documentation."
|
|
boost: 3
|
|
---
|
|
```
|
|
|
|
<div id="boost-a-navigation-group">
|
|
## 为导航分组加权
|
|
</div>
|
|
|
|
在 `docs.json` 导航中的某个分组上设置 `boost`,可将该乘数应用于其下的每个页面。
|
|
|
|
```json
|
|
{
|
|
"navigation": {
|
|
"groups": [
|
|
{
|
|
"group": "Get started",
|
|
"boost": 5,
|
|
"pages": [
|
|
"quickstart",
|
|
"concepts"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
页面会从最近一个设置了加权值的祖先那里继承加权因子。子页面或嵌套分组可以通过设置自己的 `boost` 值来覆盖继承的加权。页面 frontmatter 中的 `boost` 始终优先于从导航继承的值。
|
|
|
|
<div id="de-prioritize-content">
|
|
## 降低内容优先级
|
|
</div>
|
|
|
|
使用小于 `1` 的值可将页面在搜索结果中下推。例如,`boost: 0.5` 会将页面的相关性得分相对于其他页面减半。`boost` 为 `1` 时等同于不加权。
|
|
|
|
```mdx
|
|
---
|
|
title: "Deprecated API"
|
|
description: "Documentation for the deprecated v1 API."
|
|
boost: 0.25
|
|
---
|
|
```
|
|
|
|
<Note>
|
|
加权因子会与已有的相关性得分相乘。请谨慎使用。过大的乘数会导致相关性较低的页面在搜索结果中占据主导地位,从而降低整体搜索质量。
|
|
</Note>
|