diff --git a/service/index-service.go b/service/index-service.go index 8ac47a2..e1f282c 100644 --- a/service/index-service.go +++ b/service/index-service.go @@ -5,20 +5,22 @@ import ( "encoding/json" "fmt" "net/http" + "strings" "myschools.me/suguo/search/exceptionless" ) -func indexAdd(id *uint32, uri, title, description *string) { +func indexAdd(id *uint32, uri, requestURI, title, description *string) { + r := strings.Split(*uri, ".") idx := &struct { ID uint32 Text string Document map[string]interface{} }{ ID: *id, - Text: fmt.Sprintf("%s %s %s", *uri, *title, *description), + Text: fmt.Sprintf("%s %s %s", r[0], *title, *description), Document: map[string]interface{}{ - "url": *uri, + "url": *requestURI, "title": *title, "description": *description, }, diff --git a/service/site-service.go b/service/site-service.go index 6fffde7..9a37bd3 100644 --- a/service/site-service.go +++ b/service/site-service.go @@ -61,8 +61,7 @@ func siteAccess(uri *string) error { if title != "" { id := uint32(crc32.ChecksumIEEE([]byte(*uri))) - r := strings.Split(*uri, ".") - go indexAdd(&id, &r[0], &title, &description) + go indexAdd(&id, uri, &requestUri, &title, &description) } urls := urlAnalysis(resp.Body)