Skip to content

Commit

Permalink
update examples code [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Dec 3, 2018
1 parent fd65fbc commit a17aeb0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func main() {
rounded cards, new colors, and the 4 mysterious colored dots again`

// Add the document to the index, docId starts at 1
searcher.Index(1, types.DocData{Content: text})
searcher.Index(2, types.DocData{Content: text1})
searcher.Index(3, types.DocData{Content: text2})
searcher.Index("1", types.DocData{Content: text})
searcher.Index("2", types.DocData{Content: text1})
searcher.Index("3", types.DocData{Content: text2})

// Wait for the index to refresh
searcher.Flush()
Expand Down
6 changes: 3 additions & 3 deletions examples/info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func main() {
, I wonder where they are`}
data1 := types.DocData{Content: "所以, 你好, 再见"}
data2 := types.DocData{Content: "没有理由"}
searcher.Index(1, data)
searcher.Index(2, data1)
searcher.Index(3, data2)
searcher.Index("1", data)
searcher.Index("2", data1)
searcher.Index("3", data2)
searcher.Flush()

req := types.SearchReq{Text: "你好"}
Expand Down
10 changes: 5 additions & 5 deletions examples/new/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func main() {
data1 := types.DocData{Content: "所以, 你好, 再见"}
data2 := types.DocData{Content: "没有理由"}

searcher.Index(1, data)
searcher.Index(2, data1)
searcher.Index(3, data2)
searcher.Index("1", data)
searcher.Index("2", data1)
searcher.Index("3", data2)
searcher.Flush()

engine.Index(1, data)
engine.Index(2, data1)
engine.Index("1", data)
engine.Index("2", data1)
engine.Flush()

req := types.SearchReq{Text: "你好"}
Expand Down
6 changes: 3 additions & 3 deletions examples/pinyin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func initEngine() {
index2 := types.DocData{Content: text}
index3 := types.DocData{Content: "In the way."}

searcher.Index(10, index1)
searcher.Index(11, index2)
searcher.Index(12, index3)
searcher.Index("10", index1)
searcher.Index("11", index2)
searcher.Index("12", index3)

// 等待索引刷新完毕
searcher.Flush()
Expand Down
4 changes: 2 additions & 2 deletions examples/pinyin/old/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func initEngine() {
index1 := types.DocData{Tokens: tokenDatas, Fields: "在路上"}
index2 := types.DocData{Content: "在路上, in the way", Tokens: tokenDatas}

searcher.Index(10, index1)
searcher.Index(11, index2)
searcher.Index("10", index1)
searcher.Index("11", index2)

// 等待索引刷新完毕
searcher.Flush()
Expand Down

0 comments on commit a17aeb0

Please sign in to comment.