Skip to content

Commit

Permalink
fix exception when no date on patent. All indexes. Avoid the creation…
Browse files Browse the repository at this point in the history
… of mixed langages indexes.
  • Loading branch information
Patent2net committed Jul 20, 2022
1 parent d1ae4d8 commit 2737974
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Patent2Net/P2N-Indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ def iramCleaner (texte):
for cont in bre[cle]:
if len(cont) > 0:
doc[cle + str(counter + 1)] = cont
try:
res = es.index(index=ndf.lower(), id=cpt, body=doc)
except:
print (type(bre["date"]), " : ", bre["date"])
doc['date'] = '1000'
res = es.index(index=ndf.lower(), id=cpt, body=doc)
print(res['result'])
# try:
# res = es.index(index=ndf.lower(), id=cpt, body=doc)
# except:
# print (type(bre["date"]), " : ", bre["date"])
# doc['date'] = '1000'
# res = es.index(index=ndf.lower(), id=cpt, body=doc)
# print(res['result'])

lstFr, lstEn, lstUnk = GenereListeFichiers(Rep)
print()
Expand Down Expand Up @@ -367,7 +367,12 @@ def iramCleaner (texte):
for cle in doc.keys():
if "****" in doc [cle]:
doc [cle] = iramCleaner(doc [cle])
res = es.index(index=indexLang.lower(), id=cpt[indexLang.split('-')[0]], body=doc)
try:
res = es.index(index=indexLang.lower(), id=cpt[indexLang.split('-')[0]], body=doc)
except:
print(type(bre["date"]), " : ", bre["date"])
doc['date'] = '1000'
res = es.index(index=indexLang.lower(), id=cpt[indexLang.split('-')[0]], body=doc)

for lang in cpt.keys():
print(lang.lower() + "-" + ndf.lower() + ' ' + res['result'] + ' ' + str(cpt[lang]) + ' documents indexed')

0 comments on commit 2737974

Please sign in to comment.