master
zcy 2022-03-30 23:58:20 +08:00
parent 27ab4fa202
commit 398a9c2772
3 changed files with 3 additions and 4 deletions

View File

@ -245,7 +245,6 @@ func SearchArticleESHightLight(c *gin.Context) {
x := []RetHighlight{} x := []RetHighlight{}
_, e = db.GetElastic(). _, e = db.GetElastic().
QueryHighlight("doc", query, &x,highlight, 10, 0) QueryHighlight("doc", query, &x,highlight, 10, 0)
log.Print(x)
if nil != e { if nil != e {
log.Print(e.Error()) log.Print(e.Error())
return return

View File

@ -86,7 +86,6 @@ func (p *ElkEngine) QueryHighlight(index string, query elastic.Query, v interfac
} }
id := []string{} id := []string{}
for _, vs := range res.Hits.Hits { for _, vs := range res.Hits.Hits {
log.Print(vs.Highlight)
id = append(id, vs.Id) id = append(id, vs.Id)
data, e := vs.Source.MarshalJSON() data, e := vs.Source.MarshalJSON()
if nil != e { if nil != e {
@ -113,7 +112,6 @@ func (p *ElkEngine) QueryHighlight(index string, query elastic.Query, v interfac
} }
id := []string{} id := []string{}
for _, vs := range res.Hits.Hits { for _, vs := range res.Hits.Hits {
log.Print(vs.Highlight)
id = append(id, vs.Id) id = append(id, vs.Id)
data, e := vs.Source.MarshalJSON() data, e := vs.Source.MarshalJSON()
// log.Print(string(data)) // log.Print(string(data))

View File

@ -38,7 +38,7 @@ func CORSMiddleware(c *gin.Context) {
if config.ApiConfig().RunMode == "release" { if config.ApiConfig().RunMode == "release" {
c.Writer.Header().Set("Access-Control-Allow-Origin", "https://testingcloud.club") c.Writer.Header().Set("Access-Control-Allow-Origin", "https://testingcloud.club")
} else { } else {
c.Writer.Header().Set("Access-Control-Allow-Origin", "http://127.0.0.1") c.Writer.Header().Set("Access-Control-Allow-Origin", "http://127.0.0.1:8080")
} }
c.Writer.Header().Set("Access-Control-Max-Age", "86400") c.Writer.Header().Set("Access-Control-Max-Age", "86400")
c.Writer.Header().Set("Access-Control-Allow-Headers", c.Writer.Header().Set("Access-Control-Allow-Headers",
@ -50,6 +50,8 @@ func CORSMiddleware(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length") c.Writer.Header().Set("Access-Control-Expose-Headers", "Content-Length")
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
log.Print("remote addr is ",c.Request.RemoteAddr)
if c.Request.Method == "OPTIONS" { if c.Request.Method == "OPTIONS" {
log.Println("OPTIONS") log.Println("OPTIONS")
c.AbortWithStatus(200) c.AbortWithStatus(200)