log indexing steps with times

This commit is contained in:
Frédéric Péters 2012-09-20 18:12:13 +02:00
parent a0dd4db3c1
commit d6254a6564
1 changed files with 9 additions and 1 deletions

View File

@ -55,7 +55,7 @@ class SearchHandler(SCGIHandler):
def produce(self, env, bodysize, input, output):
if self.debug:
print 'Request received at', time.strftime('[%Y-%m-%d %H:%M]')
print 'Request received at', time.strftime('[%Y-%m-%d %H:%M:%S]')
print ' - body size:', bodysize
uri = env.get('REQUEST_URI')[len('/search/'):]
@ -143,6 +143,8 @@ class SearchHandler(SCGIHandler):
print >> output, 'Redirection'
def index(self, filename, id):
if self.debug:
print ' - extracting text at', time.strftime('[%Y-%m-%d %H:%M:%S]')
cmd = ['pdftotext', filename, '-']
try:
p = subprocess.Popen(cmd,
@ -159,8 +161,14 @@ class SearchHandler(SCGIHandler):
if self.debug:
print 'E: error running pdftotext (rc:%d)' % p.returncode
return False
if self.debug:
print ' - adding to solr at', time.strftime('[%Y-%m-%d %H:%M:%S]')
self.solr.add([{'id': id, 'text': unicode(stdout, 'utf-8')}])
if self.debug:
print ' - commiting solr at', time.strftime('[%Y-%m-%d %H:%M:%S]')
self.solr.commit()
if self.debug:
print ' - done at', time.strftime('[%Y-%m-%d %H:%M:%S]')
return True
def error_page(self, output, message):