MCPcopy Index your code
hub / github.com/huichen/wukong

github.com/huichen/wukong @v0.1

repository ↗ · DeepWiki ↗ · release v0.1 ↗ · Ask this repo → · + Follow
154 symbols 420 edges 28 files 34 documented · 22% updated 4y agov0.1 · 2013-08-13★ 4,47729 open issues
README

悟空全文搜索引擎

微博搜索演示 http://soooweibo.com

安装/更新

先安装依赖包

go get -u github.com/huichen/sego
go get -u github.com/huichen/murmur

然后安装悟空引擎

go get -u github.com/huichen/wukong

需要Go版本至少1.1.1

使用

先看一个例子(来自examples/simplest_example.go

package main

import (
    "github.com/huichen/wukong/engine"
    "github.com/huichen/wukong/types"
    "log"
)

var (
    // searcher是协程安全的
    searcher = engine.Engine{}
)

func main() {
    // 初始化
    searcher.Init(types.EngineInitOptions{
        SegmenterDictionaries: "github.com/huichen/wukong/data/dictionary.txt"})

    // 将文档加入索引
    searcher.IndexDocument(0, types.DocumentIndexData{Content: "此次百度收购将成中国互联网最大并购"})
    searcher.IndexDocument(1, types.DocumentIndexData{Content: "百度宣布拟全资收购91无线业务"})
    searcher.IndexDocument(2, types.DocumentIndexData{Content: "百度是中国最大的搜索引擎"})

    // 等待索引刷新完毕
    searcher.FlushIndex()

    // 搜索输出格式见types.SearchResponse结构体
    log.Print(searcher.Search(types.SearchRequest{Text:"百度中国"}))
}

是不是很简单!

然后看看一个入门教程,教你用不到200行Go代码实现一个微博搜索网站。

其它

Extension points exported contracts — how you extend this code

ScoringCriteria (Interface)
评分规则通用接口 [7 implementers]
types/scoring_criteria.go

Core symbols most depended-on inside this repo

AddDocument
called by 31
core/indexer.go
Lookup
called by 29
core/indexer.go
indexedDocsToString
called by 25
core/test_utils.go
IndexDocument
called by 14
engine/engine.go
Init
called by 12
engine/engine.go
Search
called by 12
engine/engine.go
indicesToString
called by 9
core/test_utils.go
AddScoringFields
called by 8
core/ranker.go

Shape

Function 77
Method 38
Struct 37
Interface 1
TypeAlias 1

Languages

Go73%
TypeScript27%

Modules by API surface

examples/codelab/static/jquery.min.js42 symbols
engine/engine_test.go16 symbols
core/indexer.go9 symbols
examples/codelab/search_server.go8 symbols
core/indexer_test.go8 symbols
engine/ranker_worker.go7 symbols
engine/engine.go7 symbols
types/search_response.go6 symbols
core/ranker_test.go6 symbols
core/ranker.go5 symbols
types/scoring_criteria.go4 symbols
examples/custom_scoring_criteria.go4 symbols

For agents

$ claude mcp add wukong \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact