Skip to content

Commit

Permalink
Fixes fossasia#298 Add time analysis of each engine for the results r…
Browse files Browse the repository at this point in the history
…etrieved
  • Loading branch information
bhaveshAn committed Nov 22, 2017
1 parent 83055e6 commit c0c2a19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ <h1><code>query-server</code></h1>
<div class="pagination-centered">
<img id="load" src="{{ url_for('static', filename='images/ripple.gif') }}">
</div>
<pre id="time-analysis" style="display:none;"><code class="language-xml"></code></pre>
<pre id="feed" style="display:none;"><code class="language-xml"></code></pre>
<br/><br/>
<div class="container">
Expand Down Expand Up @@ -133,12 +134,14 @@ <h1><code>query-server</code></h1>
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',
Expand All @@ -149,6 +152,11 @@ <h1><code>query-server</code></h1>
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]);
Expand Down

0 comments on commit c0c2a19

Please sign in to comment.