|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/astaxie/beego/toolbox"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
+
|
|
|
//"github.com/astaxie/beego/cache"
|
|
|
)
|
|
|
|
|
@@ -15,8 +16,7 @@ func Task() {
|
|
|
toolbox.AddTask("syncTacticsList", syncTacticsList)
|
|
|
toolbox.StartTask()
|
|
|
}
|
|
|
- //SyncTacticsList()
|
|
|
- //CreateIndex()
|
|
|
+ //SyncCygxArticleList()
|
|
|
fmt.Println("end")
|
|
|
}
|
|
|
|
|
@@ -171,9 +171,9 @@ searchItem.ArticleId, _ = strconv.Atoi(v.Id)
|
|
|
searchItem.Body = v.Highlight["BodyText"]
|
|
|
searchItem.Title = title
|
|
|
searchItem.PublishDate = article.PublishDate
|
|
|
- */
|
|
|
+*/
|
|
|
func CreateIndex() {
|
|
|
- indexName := "cygx_article_test"//utils.IndexName
|
|
|
+ indexName := "cygx_article_test" //utils.IndexName
|
|
|
mappingJson := `{
|
|
|
"mappings": {
|
|
|
"dynamic": true,
|
|
@@ -210,7 +210,6 @@ func CreateIndex() {
|
|
|
EsCreateIndex(indexName, mappingJson)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// "term_vector": "with_positions_offsets"
|
|
|
|
|
|
type ElasticArticleDetail struct {
|
|
@@ -231,11 +230,9 @@ type ElasticArticleDetail struct {
|
|
|
BodyText string `description:"内容"`
|
|
|
}
|
|
|
|
|
|
-
|
|
|
type ElasticTestArticleDetail struct {
|
|
|
- ArticleId int `description:"报告id"`
|
|
|
- Title string `description:"标题"`
|
|
|
- BodyText string `description:"内容"`
|
|
|
- PublishDate string `description:"发布时间"`
|
|
|
+ ArticleId int `description:"报告id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ BodyText string `description:"内容"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
}
|
|
|
-
|