Example #1
0
func commitor_and_dnf() {
	commitor.Init()
	dnf.Init()
	go commitor.CommitLoop()

	commitor.PrintAdAttr("1")
	commitor.PrintAdAttr("3")

	time.Sleep(1 * time.Second)

	dnf_test_main()

	fmt.Println("dnf_test_main end")

	conds := []dnf.Cond{{"zone", "1"}, {"region", "07"}, {"width", "200"}, {"height", "200"}}
	resultDocs, err := dnf.Search(conds)
	if err != nil {
		fmt.Println("search error: ", err)
		return
	}
	s := ""
	for _, docid := range resultDocs {
		s += strconv.Itoa(docid) + " -> "
	}
	fmt.Println("conds: ", conds)
	fmt.Println("found doc: ", s)
}
Example #2
0
File: main.go Project: hankji/dnf
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())

	commitor.Init()
	dnf.Init()
	go commitor.CommitLoop()

	time.Sleep(2 * time.Second)
	//dnf.DisplayDocs()

	go service.TcpServe()
	service.HttpServe("/ad/search", "/ad/zone", 7777)
}