From c0c2a190dbf4e0fdaa8b9baddc6975bc5f5967d3 Mon Sep 17 00:00:00 2001 From: bhaveshAn Date: Thu, 23 Nov 2017 02:23:49 +0530 Subject: [PATCH] Fixes #298 Add time analysis of each engine for the results retrieved --- app/static/css/styles.css | 7 +++++++ app/templates/index.html | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/app/static/css/styles.css b/app/static/css/styles.css index df70835c..b19c27af 100644 --- a/app/static/css/styles.css +++ b/app/static/css/styles.css @@ -27,6 +27,13 @@ body { z-index: -100000; } +#time-analysis { + font-size: 1.2em; + margin: 0em 2em 2em 2em; + padding: -3em 0 -3em 0; + z-index: -100000; +} + #load { position: relative; display: none; diff --git a/app/templates/index.html b/app/templates/index.html index c8d537ef..543051c0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -93,6 +93,7 @@

query-server

+

@@ -133,12 +134,14 @@

query-server

if ($('#query').val()) { $('#load').show(); $('#feed').hide(); + $('#time-analysis').hide(); var sengine = $(this).val(); var squery = $('#query').val(); var sformat = $(' #format label.active input').val(); var count = $('#resp').val(); var urlloc = window.location.href.split(/\?|#/)[0] + "api/v1/search/" + sengine + "?query=" + squery + "&format=" + sformat + "&num=" + count; + var startDate = new Date(); $.ajax({ url: urlloc, type: 'GET', @@ -149,6 +152,11 @@

query-server

response = JSON.stringify(response, null, 4); } else response = new XMLSerializer().serializeToString(response); + var endDate = new Date(); + var seconds = (endDate.getTime() - startDate.getTime()) / 1000; + var time_analysis_string = "Following Results fetched in " + seconds + " seconds"; + $('#time-analysis').show(); + $('#time-analysis').text(time_analysis_string); $('#feed').show(); $('#feed').text(response); Prism.highlightElement($('#feed')[0]);