Validation 15/03/22 - 10h21
parent
783f460562
commit
d20ea532e9
|
@ -131,7 +131,7 @@ def add_class(diction):
|
||||||
|
|
||||||
if ("price" in diction.keys()):
|
if ("price" in diction.keys()):
|
||||||
if diction['price']:
|
if diction['price']:
|
||||||
mydata['price'] = diction['price']
|
mydata['price'] = int(str(diction['price']))
|
||||||
|
|
||||||
if ("url" in diction.keys()):
|
if ("url" in diction.keys()):
|
||||||
if diction['url']:
|
if diction['url']:
|
||||||
|
@ -298,7 +298,7 @@ def update_class(diction):
|
||||||
|
|
||||||
if ("price" in diction.keys()):
|
if ("price" in diction.keys()):
|
||||||
if diction['price']:
|
if diction['price']:
|
||||||
mydata['price'] = diction['price']
|
mydata['price'] = int(str(diction['price']))
|
||||||
|
|
||||||
if ("url" in diction.keys()):
|
if ("url" in diction.keys()):
|
||||||
if diction['url']:
|
if diction['url']:
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
,index,mots,occurence,moyenne,id_formation,source_field
|
,index,mots,occurence,moyenne,id_formation,source_field
|
||||||
0,0,mot1,1,1.0,code01,keyword
|
0,0,ger,1,0.5,MAN10,title
|
||||||
|
1,1,polyvalent,1,0.5,MAN10,title
|
||||||
|
|
|
|
@ -158,7 +158,8 @@ def ela_index_class(external_code="", source_field = ""):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mycommon.myprint(e)
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,6 +193,7 @@ def ela_index_all_classes():
|
||||||
|
|
||||||
nb_class_indexed = 0
|
nb_class_indexed = 0
|
||||||
for doc in collection.find({'indexed':'0'}):
|
for doc in collection.find({'indexed':'0'}):
|
||||||
|
if ("title" in doc.keys() and "description" in doc.keys() ):
|
||||||
chaine = doc["title"]+" - "+doc["description"]
|
chaine = doc["title"]+" - "+doc["description"]
|
||||||
mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
|
mycommon.myprint(" external_code = "+str(doc["external_code"])+" ==> "+str(chaine))
|
||||||
retval = ela_index_class(str(doc["external_code"]))
|
retval = ela_index_class(str(doc["external_code"]))
|
||||||
|
@ -209,7 +211,8 @@ def ela_index_all_classes():
|
||||||
return True, str(nb_class_indexed)+" ont été indexes "
|
return True, str(nb_class_indexed)+" ont été indexes "
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mycommon.myprint(e)
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -275,6 +278,7 @@ def ela_index_all_classes_title():
|
||||||
|
|
||||||
nb_class_indexed = 0
|
nb_class_indexed = 0
|
||||||
for doc in collection.find({'indexed_title': '0'}):
|
for doc in collection.find({'indexed_title': '0'}):
|
||||||
|
if ("title" in doc.keys()):
|
||||||
chaine = doc["title"]
|
chaine = doc["title"]
|
||||||
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
||||||
retval = ela_index_class(str(doc["external_code"]), "title")
|
retval = ela_index_class(str(doc["external_code"]), "title")
|
||||||
|
@ -329,6 +333,7 @@ def ela_index_all_classes_desc():
|
||||||
|
|
||||||
nb_class_indexed = 0
|
nb_class_indexed = 0
|
||||||
for doc in collection.find({'indexed_desc': '0'}):
|
for doc in collection.find({'indexed_desc': '0'}):
|
||||||
|
if ("description" in doc.keys()):
|
||||||
chaine = doc["description"]
|
chaine = doc["description"]
|
||||||
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
||||||
retval = ela_index_class(str(doc["external_code"]), "description")
|
retval = ela_index_class(str(doc["external_code"]), "description")
|
||||||
|
@ -345,7 +350,8 @@ def ela_index_all_classes_desc():
|
||||||
return True, str(nb_class_indexed) + " ont été indexes - champ description "
|
return True, str(nb_class_indexed) + " ont été indexes - champ description "
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mycommon.myprint(e)
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,6 +385,7 @@ def ela_index_all_classes_obj():
|
||||||
|
|
||||||
nb_class_indexed = 0
|
nb_class_indexed = 0
|
||||||
for doc in collection.find({'indexed_obj': '0'}):
|
for doc in collection.find({'indexed_obj': '0'}):
|
||||||
|
if ("objectif" in doc.keys()):
|
||||||
chaine = doc["objectif"]
|
chaine = doc["objectif"]
|
||||||
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
|
||||||
retval = ela_index_class(str(doc["external_code"]), "objectif")
|
retval = ela_index_class(str(doc["external_code"]), "objectif")
|
||||||
|
@ -395,7 +402,8 @@ def ela_index_all_classes_obj():
|
||||||
return True, str(nb_class_indexed) + " ont été indexes - champ objectif "
|
return True, str(nb_class_indexed) + " ont été indexes - champ objectif "
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mycommon.myprint(e)
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||||
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
return False, "Impossible d'indexer la BDD des formations ==> KO"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
mots occurence moyenne id_formation source_field
|
mots occurence moyenne id_formation source_field
|
||||||
0 mot1 1 1.0 code01 keyword
|
0 ger 1 0.5 MAN10 title
|
||||||
|
1 polyvalent 1 0.5 MAN10 title
|
|
@ -55,7 +55,7 @@ def add_partner_account(diction):
|
||||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||||
# field_list.
|
# field_list.
|
||||||
'''
|
'''
|
||||||
field_list = ['nom', 'adr_street', 'adr_city', 'adr_zip', 'adr_country','link_linkedin','link_facebook','link_twitter'
|
field_list = ['nom', 'adr_street', 'adr_city', 'adr_zip', 'adr_country','link_linkedin','link_facebook','link_twitter',
|
||||||
'email','pwd', 'telephone','contact_nom','contact_prenom','contact_tel','contact_mail']
|
'email','pwd', 'telephone','contact_nom','contact_prenom','contact_tel','contact_mail']
|
||||||
incom_keys = diction.keys()
|
incom_keys = diction.keys()
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
|
|
|
@ -257,7 +257,6 @@ def recherche_text_simple(diction):
|
||||||
json = {}
|
json = {}
|
||||||
if ("price" in diction.keys()):
|
if ("price" in diction.keys()):
|
||||||
if diction['price']:
|
if diction['price']:
|
||||||
critere_date['price'] = diction['price']
|
|
||||||
if( str( diction['price']) != "NA"):
|
if( str( diction['price']) != "NA"):
|
||||||
prices = str(diction['price']).split(":")
|
prices = str(diction['price']).split(":")
|
||||||
if len(prices) > 2 :
|
if len(prices) > 2 :
|
||||||
|
@ -267,9 +266,6 @@ def recherche_text_simple(diction):
|
||||||
price_crit = {'price': {'$gte': int(str(prices[0])), '$lte': int(str(prices[1]))}}
|
price_crit = {'price': {'$gte': int(str(prices[0])), '$lte': int(str(prices[1]))}}
|
||||||
|
|
||||||
|
|
||||||
new_diction['price'] = diction['price']
|
|
||||||
print("{#############"+str(price_crit))
|
|
||||||
|
|
||||||
|
|
||||||
support_crit = {}
|
support_crit = {}
|
||||||
if ("support" in diction.keys()):
|
if ("support" in diction.keys()):
|
||||||
|
@ -339,7 +335,7 @@ def recherche_text_simple(diction):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Verification si le texte de recherche contient un pattern de tips,
|
Verification si le texte de recherche contient un pattern de tips,
|
||||||
c'est a dire une chaine de type : title:titre
|
c'est a dire une chaine de type : title:"titre"
|
||||||
|
|
||||||
Si c'est le cas, nous sommes dans le cadre d'un recherche par type
|
Si c'est le cas, nous sommes dans le cadre d'un recherche par type
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue