Commit 5a41a731 authored by sim's avatar sim

Batched documents insertion when adding a corpus

parent 68f5ecac
...@@ -175,7 +175,6 @@ def parse(corpus): ...@@ -175,7 +175,6 @@ def parse(corpus):
hyperdata = hyperdata, hyperdata = hyperdata,
) )
session.add(document) session.add(document)
session.commit()
documents_count += 1 documents_count += 1
if pending_add_error_stats: if pending_add_error_stats:
...@@ -190,6 +189,9 @@ def parse(corpus): ...@@ -190,6 +189,9 @@ def parse(corpus):
session.add(corpus) session.add(corpus)
session.commit() session.commit()
# Commit any pending document
session.commit()
# update info about the resource # update info about the resource
resource['extracted'] = True resource['extracted'] = True
#print( "resource n°",i, ":", d, "docs inside this file") #print( "resource n°",i, ":", d, "docs inside this file")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment