Validation 17/03/22 - 20h21

master
ChérifBALDE 2022-03-17 21:14:29 +01:00 committed by cherif
parent 878c98a1eb
commit bee0ca6d70
3 changed files with 20198 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -443,8 +443,8 @@ def ela_recherche_tokens(sentence):
if str(doc["id_formation"]) not in tab_training_id :
tab_training_id.append(str(doc["id_formation"]))
print(" Pour la phrase "+str(sentence)+", voici les formations correspondantes")
print(tab_training_id)
#print(" Pour la phrase "+str(sentence)+", voici les formations correspondantes")
#print(tab_training_id)
return tab_training_id
@ -496,8 +496,8 @@ def ela_recherche_tokens_source_field(sentence, source_fied=""):
if str(doc["id_formation"]) not in tab_training_id :
tab_training_id.append(str(doc["id_formation"]))
print(" Pour la phrase "+str(sentence)+", voici les formations correspondantes")
print(tab_training_id)
#print(" Pour la phrase "+str(sentence)+", voici les formations correspondantes")
#print(tab_training_id)
return tab_training_id

View File

@ -403,7 +403,7 @@ def recherche_text_simple(diction):
tab_user_recherche = dbname['user_recherche']
# seules les formation avec locked = 0 et valide=1 sont modifiables
print(str(inspect.stack()[0][3]) + " ENREG DES RESULT :"+str(store_recherche_Id)+" --- "+str(final_message2))
#print(str(inspect.stack()[0][3]) + " ENREG DES RESULT :"+str(store_recherche_Id)+" --- "+str(final_message2))
ret_val_user_rech = coll_name.find_one_and_update(
@ -436,7 +436,7 @@ def recherche_text_simple(diction):
if ("_id" in mydict_combined.keys()):
mydict_combined['class_id'] = mydict_combined.pop('_id')
mycommon.myprint("COMBINED = " + str(mydict_combined))
#mycommon.myprint("COMBINED = " + str(mydict_combined))
'''
Statistique : Insertion du recherche - resultat '''
@ -447,6 +447,12 @@ def recherche_text_simple(diction):
return False, "La recheche est impossible "
user = x
val = x['description']
if (len(x['description']) > MAX_CARACT):
x['description'] = val[:MAX_CARACT] + " ..."
else:
x['description'] = val[:MAX_CARACT]
insertObject.append(JSONEncoder().encode(user))
# mycommon.myprint(" insertObject = ", insertObject)
@ -468,9 +474,6 @@ def recherche_text_simple(diction):
" d'une recherche de formation. Voir _id = ")
return False, "La recheche est impossible "
return True, insertObject
# Fin de la recherche par tips.
@ -504,7 +507,7 @@ def recherche_text_simple(diction):
if ("_id" in mydict_combined.keys()):
mydict_combined['class_id'] = mydict_combined.pop('_id')
mycommon.myprint("COMBINED = " + str(mydict_combined))
#mycommon.myprint("COMBINED = " + str(mydict_combined))
'''
Statistique : Insertion du recherche - resultat '''
@ -515,6 +518,11 @@ def recherche_text_simple(diction):
return False, "La recheche est impossible "
user = x
val = x['description']
if (len(x['description']) > MAX_CARACT):
x['description'] = val[:MAX_CARACT] + " ..."
else:
x['description'] = val[:MAX_CARACT]
insertObject.append(JSONEncoder().encode(user))
# mycommon.myprint(" insertObject = ", insertObject)
@ -830,8 +838,8 @@ def recherche_tips_ret_ref(diction):
tab_training = []
tab_training = ela_index.ela_recherche_tokens_source_field(str(chaine[1]).lower(), str(my_tips) )
mycommon.myprint(" pour phrase : #" + str(chaine[1]).lower() + "# , Pour le tips #"+ str(my_tips)+"#, voici la liste des formations")
mycommon.myprint(tab_training)
#mycommon.myprint(" pour phrase : #" + str(chaine[1]).lower() + "# , Pour le tips #"+ str(my_tips)+"#, voici la liste des formations")
#mycommon.myprint(tab_training)
coll_name = dbname['myclass']
@ -971,8 +979,13 @@ def recherche_tips(diction):
insertObject = []
for x in coll_name.find({"external_code": {"$in": tab_training}}, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, "partner_owner_recid": 0, }):
mycommon.myprint(x)
#mycommon.myprint(x)
user = x
val = x['description']
if (len(x['description']) > MAX_CARACT):
x['description'] = val[:MAX_CARACT] + " ..."
else:
x['description'] = val[:MAX_CARACT]
insertObject.append(JSONEncoder().encode(user))
# mycommon.myprint(" insertObject = ", insertObject)
@ -1056,7 +1069,7 @@ def get_stored_recherche(diction):
RetObject = []
for retVal in coll_name.find({'user_recid': user_recid, 'valide':'1'}):
mycommon.myprint(str(retVal))
#mycommon.myprint(str(retVal))
user = retVal
RetObject.append(JSONEncoder().encode(user))