log indexing steps with times
This commit is contained in:
parent
a0dd4db3c1
commit
d6254a6564
|
@ -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):
|
||||
|
|
Reference in New Issue