summaryrefslogtreecommitdiff
path: root/web.py
diff options
context:
space:
mode:
authoryvesf <yvesf@pinky.(none)>2010-11-30 20:05:24 +0100
committeryvesf <yvesf@pinky.(none)>2010-11-30 20:05:24 +0100
commite69a04675e142d8618433a785ad33e8167ef99d2 (patch)
treea8cd134467a85890e24143514383de4dec4e42ae /web.py
parent15f17b4fce5a1e4b70709aac569c18d8cf57deba (diff)
downloadbooksearch-e69a04675e142d8618433a785ad33e8167ef99d2.tar.gz
booksearch-e69a04675e142d8618433a785ad33e8167ef99d2.zip
display time taken for processing the /search query
Diffstat (limited to 'web.py')
-rw-r--r--web.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/web.py b/web.py
index 7f8c0e5..03a7eda 100644
--- a/web.py
+++ b/web.py
@@ -2,6 +2,7 @@
# coding: utf-8
from __future__ import with_statement
import os
+import time
try:
import json
except ImportError:
@@ -123,6 +124,7 @@ def do_search(term=None):
if not term:
return flask.render_template("search.html", objects=[], term="")
+ time_start = time.time()
term = term.lower()
searcher = index_book.searcher()
query = QueryParser("content").parse(term)
@@ -151,7 +153,8 @@ def do_search(term=None):
return flask.render_template("search.html",
books=books,
- term=term)
+ term=term,
+ time=time.time()-time_start)
def log_response(sender, response):
sender.logger.debug("Request context is about to close down. "