glogcenter/glc/ldb/engine_test.go
2023-10-15 21:07:59 +08:00

56 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package ldb
import (
"fmt"
"glc/com"
"glc/ldb/sysmnt"
"glc/ldb/tokenizer"
"testing"
"time"
"github.com/gotoeasy/glang/cmn"
)
func Test_CutWords(t *testing.T) {
ws := tokenizer.CutForSearch("小明硕士毕业于中国科学院计算所后在日本京都大学深造Java和Go都学得不错Java和Go都不错的")
cmn.Debug(ws)
}
func Test_GetIP(t *testing.T) {
cmn.Debug(com.GetLocalIp())
}
func Test_GetSubDirs(t *testing.T) {
rs := sysmnt.GetStorageList()
for i := 0; i < len(rs.Data); i++ {
cmn.Debug(rs.Data[i])
}
}
func Test_all(t *testing.T) {
engine := NewDefaultEngine()
for i := 1; i <= 10000; i++ {
engine.AddTextLog("date", fmt.Sprintf(`DEBUG ==> Preparing: SELECT id,aaa,bbb, ccc,ddd,eee,fff,ggg FROM abcde WHERE (aaa%d = ?) lav%d`, i, i), "sssss_ssss")
}
time.Sleep(time.Duration(10) * time.Second)
// for i := 1; i <= 10000; i++ {
// engine.AddTextLog(` java.sql.SQLException: them aalav`)
// }
// time.Sleep(time.Duration(5) * time.Second)
// for i := 1; i <= 10000; i++ {
// engine.AddTextLog(` java.sql.SQLException: them`)
// }
// time.Sleep(time.Duration(5) * time.Second)
rs := engine.Search(` them java `, "", "", "", "", make([]string, 0), 0, true)
cmn.Debug("共查到", rs.Total, "件")
for _, v := range rs.Data {
cmn.Debug(v.Id, v.Text)
}
}