pigdoc

pigdoc

Searches official PIG documentation and summarizes answers. Triggered when users ask technical questions, configuration methods, or feature details related to PIG CLOUD, PIG AI, and pigx, or explicitly ask to "search docs", "look it up", "how to configure", or "how to implement". Search the documentation proactively when encountering specific PIG framework issues rather than relying on potentially outdated training data.

12stars
4forks
Updated 9/23/2026
SKILL.md
read-only
name
pigdoc
description

Searches official PIG documentation and summarizes answers. Triggered when users ask technical questions, configuration methods, or feature details related to PIG CLOUD, PIG AI, and pigx, or explicitly ask to "search docs", "look it up", "how to configure", or "how to implement". Search the documentation proactively when encountering specific PIG framework issues rather than relying on potentially outdated training data.

PIG Documentation Search Skill

Official PIG documentation is distributed across two indexes:

  • pig: PIG Cloud, pigx, 网关, 权限, 微服务, and other backend and platform capabilities
  • ai: PIG AI, 知识库, RAG, 模型, 向量库, 工作流, 智能体, and other AI capabilities

After triggering this skill, select the index based on the user query, then search and summarize the official answers.

Search Steps

1. Extract Keywords

Extract 1–3 core keywords from the user's query. Prefer Chinese (as the documentation is primarily in Chinese).

Examples:

  • "多数据源怎么配置" → 多数据源
  • "oauth2 登录失败" → OAuth2 登录
  • "网关路由 404" → 网关路由

Keyword Preprocessing (Project Name Normalization)

Users frequently modify official project names (such as staronex, starone, etc.). You must restore them before running searches.

This rule is mainly used for pig-side searches; do not apply pigx mapping rules to AI terminology by mistake.

  1. After extracting core terms from the user query, check if they contain a project or database name. Common formats include xx_report, xx-xxx, and xx_模块名.
  2. If the prefix is not a standard official keyword (such as module terms like report, 网关, 权限, 配置), try mapping the prefix to pigx first.
  3. Perform parallel dual-keyword queries using both the original and mapped terms:
    • Original keyword (used as a fallback)
    • Mapped keyword (used for primary results)

Examples:

  • staronex_report 库没有表结构 → Prioritize searching pigx_report, supplemented by staronex_report
  • staronex-权限 → Prioritize searching pigx-权限, supplemented by staronex-权限
  • starone report 不存在 → Prioritize searching pigx report
Recommended Mapping Rules
  • Explicit aliases: staronex, starone → pigx
  • Other custom prefixes: When a query contains <前缀>_<后缀> and the prefix is clearly a database/project prefix, prioritize changing it to pigx_<后缀>
  • In case of ambiguity (e.g., very few hits), return mapped results first, then fall back to supplementing the search with the original query

2. Select Index

Route between the pig and ai indexes based on query content:

  • Query ai when AI semantics are matched:
    • Typical keywords: PIG AI, 知识库, RAG, 模型, 向量库, Embedding, 工作流, 智能体, 图谱, Neo4j
  • Query pig when Cloud / pigx semantics are matched:
    • Typical keywords: PIG Cloud, pigx, 网关, 权限, OAuth2, 微服务, 多数据源, 注册中心, 代码生成
  • Query both pig and ai when the query contains both semantic types or is ambiguous:
    • Example: PIG AI 的知识库能不能和 pigx 权限系统一起用
    • Example: 怎么配置模型

3. Call Search API

Call the corresponding API endpoint based on the index selected in step 2:

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

If querying both indexes, send requests to both endpoints separately and merge the results.

4. Response Field Descriptions

Field Description
hits[].lvl0 Document title
hits[].content Document body (Markdown format)
hits[].url Document path (e.g., /doc/pigx/use/xxx, /doc/ai/rag/xxx)
hits[].lvl2 Document update time

5. Summarize and Answer

Format the output based on search results as follows:


According to the official PIG documentation regarding "User Query":

Answer:
[Synthesize documentation content, extract core steps or explanations, and list them in clear bullet points. Preserve critical content such as code snippets and configuration examples]

Reference Documents:

  • Document Title — One-sentence description of the document's purpose

When generating reference links, use the correct documentation route based on the matched index:

  • pig results: https://docs.pig4cloud.com/pig#{url}
  • ai results: https://docs.pig4cloud.com/ai#{url}

Summarization Principles:

  • Retain code blocks, XML/YAML configurations, and key precautions from the documentation
  • Merge information when multiple documents describe the same topic; avoid duplication
  • If both indexes were queried, deduplicate before summarizing, and state in the response whether the answer comes primarily from pig, ai, or both
  • If querying both indexes yields hits from only one index, answer based solely on the hit side
  • If search results have low relevance to the question, state so and supplement the answer using known knowledge
  • If hits is empty, inform the user that no relevant content was found in the documentation

Handling Suboptimal Search Results

If the initial search returns fewer than 2 hits or the content is clearly irrelevant, try another keyword within the selected index range, then merge and summarize the results.

Example Routing

  • 多数据源怎么配置 → Search pig
  • 知识库接入 Neo4j 怎么配 → Search ai
  • PIG AI 的知识库能不能和 pigx 权限系统一起用 → Search both pig and ai
  • staronex_report 库没有表结构 → Map to pigx, then search pig
  • 怎么配置模型 → Query is ambiguous; prioritize searching both indexes and answer according to the hits