Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fixes #298 Add time analysis of each engine for the results retrieved #341

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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