Skip to content

Conversation

@Crokily
Copy link
Contributor

@Crokily Crokily commented Sep 14, 2025

问题详情

#15

原因

原本的代码直接使用的默认搜索,但本项目是静态导出的项目,需要进行静态导出的搜索配置。

解决方案

给搜索框添加了静态搜索的配置,并添加了生成用于静态搜索支持的search.json的路由。

完成第一次commit后,搜索功能可用,但无法中文搜索

第二次commit添加了orama中文分词器,以支持中文搜索,但是效果很差……少见的词汇就搜不到,比如“部署”可搜,但“美团” 搜不到……
后来查找发现fumadocs支持的其他搜索均需要付费,只有orama是可直接用的,所以目前只能凑合用了。

后续加rag啥的有后端了,考虑用自己部署的更专业可用的搜索,或替换一些别的更好的搜索服务。

@Crokily Crokily self-assigned this Sep 14, 2025
@Crokily Crokily added the bug Something isn't working label Sep 14, 2025
@Crokily Crokily added this to Frontend Sep 14, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the search functionality issue (#15) by implementing static search support for the Next.js static export project. The solution involves configuring Orama search with Chinese tokenization for better multilingual support.

  • Added Orama search dependencies with Chinese tokenizer for static export compatibility
  • Configured static search API endpoint with Chinese word segmentation
  • Updated root provider to use static search configuration instead of default search

Reviewed Changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.

File Description
package.json Added Orama search dependencies for static search functionality
app/search.json/route.ts Created static search API endpoint with Chinese tokenizer configuration
app/layout.tsx Updated RootProvider to use static search configuration
app/docs/ai/llm-basics/pytorch/index.mdx Fixed image paths to use relative paths instead of absolute paths
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Crokily and others added 2 commits September 14, 2025 21:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@longsizhuo
Copy link
Member

诶??这么复杂吗,不可以直接字符串匹配搜索么

@Crokily
Copy link
Contributor Author

Crokily commented Sep 14, 2025

诶??这么复杂吗,不可以直接字符串匹配搜索么

字符串匹配得遍历整个站的内容,效率和性能不行,文档站以后内容越多性能会越差。

@longsizhuo longsizhuo merged commit bad0435 into InvolutionHell:main Sep 14, 2025
1 check passed
@github-project-automation github-project-automation bot moved this to Done in Frontend Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants