Skip to content

Commit fae4147

Browse files
committed
fix for the searchcode search
1 parent 269793d commit fae4147

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

server/model/searchcode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package model
22

33
type SearchCodeRes struct {
4-
Previouspage string `json:"previouspage"`
4+
Previouspage int `json:"previouspage"`
55
Query string `json:"query"`
66
Total int `json:"total"`
77
Page int `json:"page"`

server/search/codesearch/search.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func RunTask(duration time.Duration) {
3030
SaveResults(codeResults, &rule.Content)
3131
}
3232
global.GVA_LOG.Info(fmt.Sprintf("Compelete the scan of searchcode"))
33+
time.Sleep(duration * time.Second)
3334
}
3435

3536
func SaveResults(results []*model.SearchResult, keyword *string) {
@@ -57,6 +58,7 @@ func SearchForSearchCode(rule model.Rule, request *gorequest.SuperAgent) []*mode
5758
page := 0
5859
for {
5960
url := "https://searchcode.com/api/codesearch_I/?q=" + keyword + "&p=" + strconv.Itoa(page)
61+
global.GVA_LOG.Info("search searchcode result for page " + strconv.Itoa(page))
6062
codeResults, hasResult := GetResult(request, url)
6163
totalCodeResults = append(totalCodeResults, codeResults...)
6264
page++
@@ -90,7 +92,6 @@ func GetResult(request *gorequest.SuperAgent, url string) ([]*model.SearchResult
9092
if strings.Contains(val.Repo, "github") {
9193
continue
9294
}
93-
//fmt.Println(val.Filename)
9495
var lines string
9596
for _, line := range val.Lines {
9697
lines += fmt.Sprint(line) + "\n"

0 commit comments

Comments
 (0)