Jianghan 2 ani în urmă
părinte
comite
9b35edf4b4
2 a modificat fișierele cu 4 adăugiri și 5 ștergeri
  1. 4 4
      elastic/elasticSim.go
  2. 0 1
      mysqldb/mysql.go

+ 4 - 4
elastic/elasticSim.go

@@ -181,13 +181,13 @@ func (e *Elastic) BulkSave(index string, obj []map[string]interface{}) {
 }
 
 //根据id删除索引对象
-func (e *Elastic) DelById(index, itype, id string) bool {
+func (e *Elastic) DelById(index, id string) bool {
 	client := e.GetEsConn()
 	defer e.DestoryEsConn(client)
 	b := false
 	if client != nil {
 		var err error
-		_, err = client.Delete().Index(index).Type(itype).Id(id).Do(context.Background())
+		_, err = client.Delete().Index(index).Id(id).Do(context.Background())
 		if err != nil {
 			log.Println("更新检索出错:", err.Error())
 		} else {
@@ -369,7 +369,7 @@ func (e *Elastic) UpdateBulk(index, itype string, docs ...[]map[string]interface
 	client := e.GetEsConn()
 	defer e.DestoryEsConn(client)
 	bulkService := client.Bulk().Index(index).Refresh("true")
-	bulkService.Type(itype)
+	// bulkService.Type(itype)
 	for _, d := range docs {
 		id := d[0]["_id"].(string)
 		doc := es.NewBulkUpdateRequest().Id(id).Doc(d[1])
@@ -389,7 +389,7 @@ func (e *Elastic) UpsertBulk(ctx context.Context, index string, ids []string, do
 	client := e.GetEsConn()
 	defer e.DestoryEsConn(client)
 	bulkService := client.Bulk().Index(index).Refresh("true")
-	bulkService.Type("bidding")
+	// bulkService.Type("bidding")
 	for i := range ids {
 		doc := es.NewBulkUpdateRequest().Id(ids[i]).Doc(docs[i]).Upsert(docs[i])
 		bulkService.Add(doc)

+ 0 - 1
mysqldb/mysql.go

@@ -388,7 +388,6 @@ func (m *Mysql) UpdateByTx(tx *sql.Tx, tableName string, query, update map[strin
 		values = append(values, v)
 	}
 	q := fmt.Sprintf("update %s set %s where %s", tableName, strings.Join(q_fs, ","), strings.Join(u_fs, " and "))
-	log.Println(q, values)
 	return m.UpdateOrDeleteBySqlByTx(tx, q, values...) >= 0
 }