|
@@ -215,6 +215,7 @@ class Product_Manager(Product_Dict_Manager):
|
|
|
|
|
|
if specs is not None and specs!="":
|
|
if specs is not None and specs!="":
|
|
specs_vector = request_embedding(specs)
|
|
specs_vector = request_embedding(specs)
|
|
|
|
+ log("getting sepcs %s"%(specs))
|
|
if specs_vector is not None:
|
|
if specs_vector is not None:
|
|
Coll,_ = self.get_collection(SPECS_GRADE)
|
|
Coll,_ = self.get_collection(SPECS_GRADE)
|
|
search_list = search_embedding(Coll,embedding_index_name,[name_vector],self.search_params,output_fields,limit=60)
|
|
search_list = search_embedding(Coll,embedding_index_name,[name_vector],self.search_params,output_fields,limit=60)
|
|
@@ -225,8 +226,11 @@ class Product_Manager(Product_Dict_Manager):
|
|
ots_name = _search.entity.get("standard_name")
|
|
ots_name = _search.entity.get("standard_name")
|
|
ots_parent_id = _search.entity.get("ots_parent_id")
|
|
ots_parent_id = _search.entity.get("ots_parent_id")
|
|
|
|
|
|
|
|
+ log("checking %s and %s"%(specs,ots_name))
|
|
if is_similar(specs,ots_name):
|
|
if is_similar(specs,ots_name):
|
|
|
|
+ log("is_similar")
|
|
if check_specs(specs,ots_name):
|
|
if check_specs(specs,ots_name):
|
|
|
|
+ log("check_specs succeed")
|
|
new_specs = ots_name
|
|
new_specs = ots_name
|
|
|
|
|
|
# to update the document_product_dict which is builded for search
|
|
# to update the document_product_dict which is builded for search
|
|
@@ -254,6 +258,7 @@ class Product_Manager(Product_Dict_Manager):
|
|
if _dpd.updateAlias(specs):
|
|
if _dpd.updateAlias(specs):
|
|
_dpd.update_row(self.ots_client)
|
|
_dpd.update_row(self.ots_client)
|
|
else:
|
|
else:
|
|
|
|
+ log("check_specs failed")
|
|
new_specs = clean_product_specs(specs)
|
|
new_specs = clean_product_specs(specs)
|
|
# insert into document_product_dict a new record
|
|
# insert into document_product_dict a new record
|
|
# to update the document_product_dict which is builded for search
|
|
# to update the document_product_dict which is builded for search
|
|
@@ -275,7 +280,27 @@ class Product_Manager(Product_Dict_Manager):
|
|
|
|
|
|
else:
|
|
else:
|
|
# add new specs?
|
|
# add new specs?
|
|
- pass
|
|
|
|
|
|
+ log("not similar")
|
|
|
|
+ if is_legal_specs(specs):
|
|
|
|
+ log("is_legal_specs")
|
|
|
|
+ new_specs = clean_product_specs(specs)
|
|
|
|
+ # insert into document_product_dict a new record
|
|
|
|
+ # to update the document_product_dict which is builded for search
|
|
|
|
+ # add new specs
|
|
|
|
+ if brand_ots_id is not None and name_ots_id is not None:
|
|
|
|
+ _md5 = get_document_product_dict_id(brand_ots_id,new_specs)
|
|
|
|
+ _d = {DOCUMENT_PRODUCT_DICT_ID:_md5,
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_NAME:new_specs,
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_ALIAS:"%s&&%s"%(specs,new_specs),
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_GRADE:SPECS_GRADE,
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_STATUS:1,
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_PARENT_ID:brand_ots_id,
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_CREATE_TIME:getCurrent_date(format="%Y-%m-%d %H:%M:%S"),
|
|
|
|
+ DOCUMENT_PRODUCT_DICT_UPDATE_TIME:getCurrent_date(format="%Y-%m-%d %H:%M:%S"),
|
|
|
|
+ }
|
|
|
|
+ _dpd = Document_product_dict(_d)
|
|
|
|
+ _dpd.update_row(self.ots_client)
|
|
|
|
+
|
|
|
|
|
|
# judge if the product matches the standard product
|
|
# judge if the product matches the standard product
|
|
if name_ots_id is not None:
|
|
if name_ots_id is not None:
|
|
@@ -444,8 +469,9 @@ class Product_Manager(Product_Dict_Manager):
|
|
|
|
|
|
def start_processing(self):
|
|
def start_processing(self):
|
|
scheduler = BlockingScheduler()
|
|
scheduler = BlockingScheduler()
|
|
- scheduler.add_job(self.producer,"cron",minute="*/1")
|
|
|
|
|
|
+ scheduler.add_job(self.producer,"cron",second="*/20")
|
|
scheduler.add_job(self.comsumer,"cron",minute="*/1")
|
|
scheduler.add_job(self.comsumer,"cron",minute="*/1")
|
|
|
|
+ scheduler.add_job(self.embedding_comsumer,"cron",minute="*/1")
|
|
scheduler.start()
|
|
scheduler.start()
|
|
|
|
|
|
|
|
|