-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
56 lines (44 loc) · 1.11 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"log"
"yagoo/web"
"gopkg.in/ini.v1"
)
var (
user string
password string
dbname string
)
func loadIniFile(initPath string) {
cfg, err := ini.Load(initPath)
if err != nil {
log.Fatal("Fail to read file: "+initPath, " ", err)
}
user = cfg.Section("database").Key("user").String()
password = cfg.Section("database").Key("password").String()
dbname = cfg.Section("database").Key("dbname").String()
}
func main() {
initPath := "my.ini"
loadIniFile(initPath)
/* read csv , preprocess data(into inverted index).*/
// csvPath := "resources/wukong_test.csv"
// storage.PreProcess(csvPath)
/* iterate and print leveldb */
// storage.TestPrintDB("./data")
/* get a certain database id*/
// str := test.GetDBValue(1)
// fmt.Println(str)
/* test Leveldb value */
// test.TestPrintValue("./data", "连衣裙")
/*search for a token*/
// e := search.NewEngine("./data", 30)
// var token string
// fmt.Println("Enter what you what to search:")
// fmt.Scan(&token)
// e.SearchCutWord(token)
/*gin test*/
// web.GinTest()
/*search and return data to front end*/
web.GinTest()
}