From a5c01a3f115399b55f43d639c8278b8d68c6211c Mon Sep 17 00:00:00 2001
From: ax_rd <ax_rd@aisim.cn>
Date: Thu, 03 Sep 2026 11:26:53 +0800
Subject: [PATCH] feat: wikilink 边可信度标注(exact/fuzzy)+ 悬空链接入 unresolved_links 表
---
cmd/search.go | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/cmd/search.go b/cmd/search.go
index 88c0065..7083750 100644
--- a/cmd/search.go
+++ b/cmd/search.go
@@ -37,6 +37,9 @@
searchCmd.Flags().BoolVar(&jsonOut, "json", false, "JSON 格式输出")
searchCmd.Flags().BoolVar(&withContent, "with-content", false, "返回完整文件内容")
searchCmd.Flags().BoolVar(&withLinks, "with-links", false, "显示关联文档链接")
+
+ // 参数不足时显示 help
+ searchCmd.SetUsageTemplate(searchCmd.Long)
}
func runSearch(cmd *cobra.Command, args []string) error {
@@ -47,16 +50,16 @@
}
defer store.Close()
- // 检查是否需要重建索引
- needsRebuild, commit, err := index.NeedsRebuild(store, vaultPath)
+ // pre-flight:快速检查索引是否有变更(只 stat 比对,不读内容)
+ dirty, err := index.QuickCheck(store, vaultPath)
if err != nil {
return fmt.Errorf("检查索引状态失败: %w", err)
}
- if needsRebuild {
- fmt.Fprintln(os.Stderr, "索引过期,正在重建...")
- if err := rebuildIndex(store, commit); err != nil {
- return fmt.Errorf("重建索引失败: %w", err)
+ if dirty {
+ fmt.Fprintln(os.Stderr, "索引有变更,正在增量同步...")
+ if err := syncIndex(store); err != nil {
+ return fmt.Errorf("增量同步失败: %w", err)
}
}
--
Gitblit v1.10.0