maxiaoshan 5 years ago
parent
commit
8b798ee1ec
2 changed files with 9 additions and 10 deletions
  1. 7 8
      udpcreateindex/src/bidingpurchasing.go
  2. 2 2
      udpcreateindex/src/task.go

+ 7 - 8
udpcreateindex/src/bidingpurchasing.go

@@ -216,6 +216,10 @@ func site_attach_text(q map[string]interface{}) {
 	i := 0
 	for tmp := make(map[string]interface{}); query.Next(tmp); i = i + 1 {
 		n++
+		//计数
+		if n%savesizei == 0 {
+			log.Println("当前:", n)
+		}
 		site, _ := tmp["site"].(string)
 		if util.IntAll(tmp["extracttype"]) == -1 || site != "中国招标投标公共服务平台" || tmp["attach_text"] == nil {
 			tmp = make(map[string]interface{})
@@ -224,9 +228,8 @@ func site_attach_text(q map[string]interface{}) {
 		newTmp := map[string]interface{}{} //最终生索引的数据
 		saveArr := []map[string]interface{}{}
 
-		filetext := getFileText(tmp)                       //oss拼装filetext
-		filetext_afterspace := FilterDetailSpace(filetext) //去除空格
-		if len(filetext_afterspace) > 10 {
+		filetext := getFileText(tmp) //oss拼装filetext
+		if len(filetext) > 10 {
 			tmp["detail"] = filetext //filetext替换detail
 			saveArr = append(saveArr, map[string]interface{}{"_id": tmp["_id"]})
 			saveArr = append(saveArr, map[string]interface{}{
@@ -237,7 +240,7 @@ func site_attach_text(q map[string]interface{}) {
 			})
 			newTmp["filetext"] = filetext //
 		} else {
-			log.Println("filetext is null string:", tmp["_id"])
+			//log.Println("filetext is null string:", tmp["_id"])
 			tmp = make(map[string]interface{})
 			continue
 		}
@@ -323,10 +326,6 @@ func site_attach_text(q map[string]interface{}) {
 			arrEs = []map[string]interface{}{}
 		}
 		SaveUpdageLock.Unlock()
-		//计数
-		if n%savesizei == 0 {
-			log.Println("当前:", n)
-		}
 		tmp = make(map[string]interface{})
 	}
 

+ 2 - 2
udpcreateindex/src/task.go

@@ -60,8 +60,8 @@ func crontab() {
 	defer qutil.Catch()
 	q := map[string]interface{}{
 		"_id": map[string]interface{}{
-			"$gte": qutil.StringTOBsonId("5e9a0b7650b5ea296ef5403c"), //2020-02-01 5e344f0b50b5ea296ed0cfbd
-			"$lte": qutil.StringTOBsonId("5e9a0b7650b5ea296ef5403c"), //2020-04-22 5e9f1880f2c1a7850ba43979
+			"$gte": qutil.StringTOBsonId("5e344f000000000000000000"), //2020-02-01 5e344f000000000000000000
+			"$lte": qutil.StringTOBsonId("5ea1bb800000000000000000"), //2020-04-23 5ea1bb800000000000000000
 		},
 	}
 	site_attach_text(q)