pigdoc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PIG 文档搜索技能

PIG Documentation Search Skill

PIG 官方文档库(
pig
索引)包含最新的使用指南、配置说明和最佳实践,搜索后总结能给出准确的官方答案。
The PIG official documentation library (
pig
index) contains the latest user guides, configuration instructions and best practices. Summarizing after searching can provide accurate official answers.

搜索步骤

Search Steps

1. 提取关键词

1. Extract Keywords

从用户问题中提取 1-3 个核心关键词。优先使用中文(文档以中文为主)。
示例:
  • "多数据源怎么配置" →
    多数据源
  • "oauth2 登录失败" →
    OAuth2 登录
  • "网关路由 404" →
    网关路由
Extract 1-3 core keywords from the user's question. Chinese is preferred (the documentation is mainly in Chinese).
Examples:
  • "How to configure multiple data sources" →
    多数据源
  • "OAuth2 login failure" →
    OAuth2 登录
  • "Gateway routing 404 error" →
    网关路由

2. 调用搜索接口

2. Call the Search API

bash
curl -s -X POST "https://search.pig4cloud.com/indexes/pig/search" \
  -H "Content-Type: application/json" \
  -d '{"q": "关键词", "limit": 3}'
bash
curl -s -X POST "https://search.pig4cloud.com/indexes/pig/search" \
  -H "Content-Type: application/json" \
  -d '{"q": "关键词", "limit": 3}'

3. 响应字段说明

3. Response Field Description

字段含义
hits[].lvl0
文档标题
hits[].content
文档正文(Markdown 格式)
hits[].url
文档路径(如
/doc/pigx/use/xxx
hits[].lvl2
文档更新时间
FieldMeaning
hits[].lvl0
Document title
hits[].content
Document body (Markdown format)
hits[].url
Document path (e.g.
/doc/pigx/use/xxx
)
hits[].lvl2
Document update time

4. 总结并回答

4. Summarize and Answer

基于搜索结果,按以下格式输出:

根据 PIG 官方文档,关于「用户问题」:
解答: [综合文档内容,提炼核心步骤或说明,用清晰要点列出。保留代码片段、配置示例等关键内容]
参考文档:

总结原则:
  • 保留文档中的代码块、XML/YAML 配置、关键注意事项
  • 多篇文档说同一件事时合并,不重复
  • 若搜索结果与问题关联度低,说明后基于已知知识补充回答
  • hits
    为空,告知用户文档暂无相关内容
Output in the following format based on search results:

According to PIG official documentation, regarding "[user question]":
Solution: [Synthesize the content of the documentation, extract core steps or descriptions, and list them in clear points. Retain key content such as code snippets and configuration examples]
Reference Documentation:
  • Document Title — A one-sentence description of the purpose of this document

Summarization Principles:
  • Retain code blocks, XML/YAML configurations, and key precautions in the documentation
  • Merge content when multiple documents describe the same issue, avoid duplication
  • If the relevance of search results to the question is low, explain it first and then supplement the answer based on known knowledge
  • If
    hits
    is empty, inform the user that there is no relevant content in the documentation for now

搜索不理想时

When Search Results Are Unsatisfactory

第一次搜索命中少于 2 条或内容明显不相关时,换一个关键词再搜一次,合并两次结果总结。
When the first search returns fewer than 2 hits or the content is obviously irrelevant, search again with another keyword, and summarize the combined results of the two searches.