Expand description
全文搜索结果页 /search?q=:顶部 Composer,结果按相关度或时间排列,命中词高亮。
输入停顿后自动检索,回车立即提交;编辑与清空会立即作废旧请求。输入框里按 ↓ 进入结果,结果间 ↑↓ 移动,↑ 越过第一条回到输入框。未输入时给出常用标签。
搜索请求只在浏览器发起(Effect / 事件处理里 spawn_local),页面没有 SSR 数据,
因此路由使用默认 SsrMode。服务端与水合首帧都按 ?q= 渲染输入框、不渲染结果;
历史记录里保存的状态在挂载后的 Effect 里恢复,保证两端首帧 DOM 一致。
Structs§
- Marked
Props 🔒 - Props for the
Markedcomponent. - Search
History 🔒State - Only settled responses are persisted; request IDs and pending work belong to the mounted page and must never be revived by browser Back.
- Search
Page 🔒Props - Props for the
SearchPagecomponent. - Search
Result 🔒Item Props - Props for the
SearchResultItemcomponent. - Search
Route - 搜索路由,对应
/search(查询参数q)。没有 SSR 数据,请求全部在浏览器发起。 - Suggested
Tags 🔒Props - Props for the
SuggestedTagscomponent.
Enums§
Constants§
- RESULT_
LIMIT 🔒 - 服务端最多返回的条数。
- RESULT_
TAGS 🔒 - 每条结果最多列出的标签数。
- SEARCH_
DEBOUNCE_ 🔒MS - SNIPPET_
RADIUS 🔒 - 摘要片段在命中词两侧保留的字数。
- SUGGESTED_
TAGS 🔒 - 未输入时推荐的标签数。
Functions§
- Marked 🔒
- 命中词用
<mark>标出的一段文字。 - Search
Page 🔒 - 搜索页。
q来自/search?q=:历史记录里没有保存的查询时用它作为初始查询并立即搜索。 - Search
Result 🔒Item - Required Props
- Suggested
Tags 🔒 - 未输入时的「试试这些标签」。标签接口失败时不显示。
- __
Search 🔒Route_ View - focus_
result 🔒 - focused_
result 🔒 - 当前获得焦点的结果序号(仅 wasm;服务端渲染时没有焦点)。
- ordered 🔒
- 服务端已按相关度排序;「最新」在浏览器里按发布时间重排,同时间按 id 稳定。
- result_
id 🔒 - results_
view 🔒 - 搜索完成后的内容:无结果提示,或工具栏(计数 + 排序)与结果列表。
Type Aliases§
- Search
Result 🔒 - 搜索结果:成功的响应,或失败。