============================================================ 第一部分:接口定义和类型 ============================================================ AsyncSearchPlugin 异步搜索插件接口
| 19 | |
| 20 | // AsyncSearchPlugin 异步搜索插件接口 |
| 21 | type AsyncSearchPlugin interface { |
| 22 | // Name 返回插件名称 |
| 23 | Name() string |
| 24 | |
| 25 | // Priority 返回插件优先级 |
| 26 | Priority() int |
| 27 | |
| 28 | // AsyncSearch 异步搜索方法 |
| 29 | AsyncSearch(keyword string, searchFunc func(*http.Client, string, map[string]interface{}) ([]model.SearchResult, error), mainCacheKey string, ext map[string]interface{}) ([]model.SearchResult, error) |
| 30 | |
| 31 | // SetMainCacheKey 设置主缓存键 |
| 32 | SetMainCacheKey(key string) |
| 33 | |
| 34 | // SetCurrentKeyword 设置当前搜索关键词(用于日志显示) |
| 35 | SetCurrentKeyword(keyword string) |
| 36 | |
| 37 | // Search 兼容性方法(内部调用AsyncSearch) |
| 38 | Search(keyword string, ext map[string]interface{}) ([]model.SearchResult, error) |
| 39 | |
| 40 | // SkipServiceFilter 返回是否跳过Service层的关键词过滤 |
| 41 | // 对于磁力搜索等需要宽泛结果的插件,应返回true |
| 42 | SkipServiceFilter() bool |
| 43 | } |
| 44 | |
| 45 | // PluginWithWebHandler 支持Web路由的插件接口 |
| 46 | // 插件可以选择实现此接口来注册自定义的HTTP路由 |
no outgoing calls
no test coverage detected