Permalink
Browse files

Use final results counts in progress bar detailed statistics.

Using unfiltered detailed counts (local and remote entries found before
doubles detection and before applying query modifiers) was confusing and
inconsistent with the total count. It could let think more results are
to come in the next pages, without understanding why they are not
displayed.
  • Loading branch information...
luccioman committed Aug 31, 2017
1 parent 2f71005 commit 30c2f50e0bd3dcf7fdc483bb276034ffcf5ada71
@@ -44,7 +44,7 @@ function fadeOutBar() {
/**
* @returns pagination buttons
*/
function renderPaginationButtons(offset, itemscount, itemsperpage, totalcount, localResourceSize, remoteResourceSize, remoteIndexCount, remotePeerCount, navurlbase, localQuery) {
function renderPaginationButtons(offset, itemsperpage, totalcount, navurlbase, localQuery) {
var resnav = "<ul class=\"pagination\">";
var thispage = Math.floor(offset / itemsperpage);
var firstPage = thispage - (thispage % 10);
@@ -95,7 +95,7 @@ function parseFormattedInt(strIntValue) {
return intValue;
}
function statistics(offset, itemscount, itemsperpage, totalcount, localResourceSize, remoteResourceSize, remoteIndexCount, remotePeerCount, navurlbase, localQuery, feedRunning) {
function statistics(offset, itemscount, itemsperpage, totalcount, localIndexCount, remoteIndexCount, remotePeerCount, navurlbase, localQuery, feedRunning) {
var totalcountIntValue = parseFormattedInt(totalcount);
var offsetIntValue = parseFormattedInt(offset);
var itemscountIntValue = parseFormattedInt(itemscount);
@@ -124,17 +124,43 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localResourceS
if (totalcountIntValue == 0) {
return;
}
var progresseBarElement = document.getElementById("progressbar");
if (offsetIntValue >= 0) document.getElementById("offset").innerHTML = offset;
if (offsetIntValue >= 0) document.getElementById("startRecord").setAttribute('value', offsetIntValue - 1);
if (itemscountIntValue >= 0) document.getElementById("itemscount").firstChild.nodeValue = itemscount;
document.getElementById("totalcount").firstChild.nodeValue = totalcount;
if (document.getElementById("localResourceSize") != null) document.getElementById("localResourceSize").firstChild.nodeValue = localResourceSize;
if (document.getElementById("remoteResourceSize") != null) document.getElementById("remoteResourceSize").firstChild.nodeValue = remoteResourceSize;
if (document.getElementById("remoteIndexCount") != null) document.getElementById("remoteIndexCount").firstChild.nodeValue = remoteIndexCount;
if (document.getElementById("remotePeerCount") != null) document.getElementById("remotePeerCount").firstChild.nodeValue = remotePeerCount;
var elementToUpdate = document.getElementById("offset");
if (offsetIntValue >= 0 && elementToUpdate != null) {
elementToUpdate.innerHTML = offset;
}
elementToUpdate = document.getElementById("startRecord");
if (offsetIntValue >= 0 && elementToUpdate != null) {
elementToUpdate.setAttribute('value', offsetIntValue - 1);
}
elementToUpdate = document.getElementById("itemscount");
if (itemscountIntValue >= 0 && elementToUpdate != null) {
elementToUpdate.firstChild.nodeValue = itemscount;
}
elementToUpdate = document.getElementById("totalcount");
if(elementToUpdate != null) {
elementToUpdate.firstChild.nodeValue = totalcount;
}
elementToUpdate = document.getElementById("localIndexCount");
if (elementToUpdate != null) {
elementToUpdate.firstChild.nodeValue = localIndexCount;
}
elementToUpdate = document.getElementById("remoteIndexCount");
if (elementToUpdate != null) {
elementToUpdate.firstChild.nodeValue = remoteIndexCount;
}
elementToUpdate = document.getElementById("remotePeerCount");
if (elementToUpdate != null) {
elementToUpdate.firstChild.nodeValue = remotePeerCount;
}
// compose page navigation
var progresseBarElement = document.getElementById("progressbar");
if (progresseBarElement.getAttribute('class') != "progress-bar progress-bar-success") {
var percent = 100 * (itemscountIntValue - offsetIntValue + 1) / itemsperpageIntValue;
if (percent == 100) {
@@ -148,9 +174,7 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localResourceS
}
var resnavElement = document.getElementById("resNav");
if (resnavElement != null) {
resnavElement.innerHTML = renderPaginationButtons(offsetIntValue, itemscountIntValue, itemsperpageIntValue,
totalcountIntValue, parseFormattedInt(localResourceSize), parseFormattedInt(remoteResourceSize), parseFormattedInt(remoteIndexCount),
parseFormattedInt(remotePeerCount), navurlbase, localQuery);
resnavElement.innerHTML = renderPaginationButtons(offsetIntValue, itemsperpageIntValue, totalcountIntValue, navurlbase, localQuery);
}
}
@@ -112,7 +112,8 @@
<div id="results"></div>
<div class="progress">
<div class="progress-bar progress-bar-info" id="progressbar" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:0%;">
<span style="position:absolute;display:block;text-align:left;width:85%;color:black;">&nbsp;&nbsp;&nbsp;<strong id="offset">#[offset]#</strong>-<strong id="itemscount">#[itemscount]#</strong> of <strong id="totalcount">#[totalcount]#</strong> #(globalresults)#::; (<strong id="localResourceSize">#[localResourceSize]#</strong> local, <strong id="remoteResourceSize">#[remoteResourceSize]#</strong> remote), <strong id="remoteIndexCount">#[remoteIndexCount]#</strong> from <strong id="remotePeerCount">#[remotePeerCount]#</strong> remote YaCy peers.#(/globalresults)#
<span style="position:absolute;display:block;text-align:left;width:85%;color:black;">&nbsp;&nbsp;&nbsp;<strong id="offset">#[offset]#</strong>-<strong id="itemscount">#[itemscount]#</strong> of <strong id="totalcount">#[totalcount]#</strong>
#(globalresults)#::; (<strong id="localIndexCount">#[localIndexCount]#</strong> local, <strong id="remoteIndexCount">#[remoteIndexCount]#</strong> remote from <strong id="remotePeerCount">#[remotePeerCount]#</strong> YaCy peers).#(/globalresults)#
<span id="feedingStatus" style="visibility: hidden;" class="glyphicon glyphicon-transfer" title="YaCy server is fetching results from available data sources."></span>
</span>
</div>
@@ -221,7 +222,7 @@ <h4 class="linktitle">
}
if(rsp && rsp.offset != null) {
statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localResourceSize, rsp.remoteResourceSize, rsp.remoteIndexCount, rsp.remotePeerCount, rsp.navurlBase, #[localQuery]#, rsp.feedRunning);
statistics(rsp.offset, rsp.itemscount, rsp.itemsperpage, rsp.totalcount, rsp.localIndexCount, rsp.remoteIndexCount, rsp.remotePeerCount, rsp.navurlBase, #[localQuery]#, rsp.feedRunning);
if(rsp.feedRunning) {
/* Refresh statistics while server feeders are still running */
window.setTimeout(latestinfo, 1000);
@@ -823,7 +823,7 @@ public static serverObjects respond(
prop.put("num-results_itemsPerPage", Formatter.number(itemsPerPage));
prop.put("num-results_totalcount", Formatter.number(theSearch.getResultCount())); // also in yacyserchtrailer (hint: timing in p2p search )
prop.put("num-results_globalresults", global && (indexReceiveGranted || clustersearch) ? "1" : "0");
prop.put("num-results_globalresults_localResourceSize", Formatter.number(theSearch.local_rwi_stored.get() + theSearch.local_solr_stored.get(), true));
prop.put("num-results_globalresults_localIndexCount", Formatter.number(theSearch.local_rwi_stored.get() + theSearch.local_solr_stored.get(), true));
prop.put("num-results_globalresults_remoteResourceSize", Formatter.number(theSearch.remote_rwi_stored.get() + theSearch.remote_solr_stored.get(), true));
prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true));
prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true));
@@ -59,6 +59,6 @@ <h4 class="linktitle">
#(statistics)#::
<script type="text/javascript">
statistics("#[offset]#", "#[itemscount]#", "#[itemsperpage]#", "#[totalcount]#", "#[localResourceSize]#", "#[remoteResourceSize]#", "#[remoteIndexCount]#", "#[remotePeerCount]#", "#[navurlBase]#", #[localQuery]#, #[feedRunning]#);
statistics("#[offset]#", "#[itemscount]#", "#[itemsperpage]#", "#[totalcount]#", "#[localIndexCount]#", "#[remoteIndexCount]#", "#[remotePeerCount]#", "#[navurlBase]#", #[localQuery]#, #[feedRunning]#);
</script>
#(/statistics)#
@@ -118,8 +118,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
prop.put("statistics_itemscount", Formatter.number(Math.min((item < 0) ? theSearch.query.neededResults() : item + 1, theSearch.getResultCount())));
prop.put("statistics_itemsperpage", Formatter.number(theSearch.query.itemsPerPage));
prop.put("statistics_totalcount", Formatter.number(theSearch.getResultCount(), true));
prop.put("statistics_localResourceSize", Formatter.number(theSearch.local_rwi_stored.get() + theSearch.local_solr_stored.get(), true));
prop.put("statistics_remoteResourceSize", Formatter.number(theSearch.remote_rwi_stored.get() + theSearch.remote_solr_stored.get(), true));
prop.put("statistics_localIndexCount", Formatter.number(theSearch.local_rwi_available.get() + theSearch.local_solr_available.get(), true));
prop.put("statistics_remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true));
prop.put("statistics_remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true));
prop.put("statistics_navurlBase", QueryParams.navurlBase(RequestHeader.FileType.HTML, theSearch.query, null, false).toString());
@@ -24,6 +24,7 @@ public static serverObjects respond(@SuppressWarnings("unused") final RequestHea
prop.put("itemsperpage", 10);
prop.put("totalcount", 0);
prop.put("localResourceSize", 0);
prop.put("localIndexCount", 0);
prop.put("remoteResourceSize", 0);
prop.put("remoteIndexCount", 0);
prop.put("remotePeerCount", 0);
@@ -39,6 +40,7 @@ public static serverObjects respond(@SuppressWarnings("unused") final RequestHea
prop.put("itemsperpage", theSearch.query.itemsPerPage);
prop.put("totalcount", Formatter.number(theSearch.getResultCount(), true));
prop.put("localResourceSize", Formatter.number(theSearch.local_rwi_stored.get() + theSearch.local_solr_stored.get(), true));
prop.put("localIndexCount", Formatter.number(theSearch.local_rwi_available.get() + theSearch.local_solr_available.get(), true));
prop.put("remoteResourceSize", Formatter.number(theSearch.remote_rwi_stored.get() + theSearch.remote_solr_stored.get(), true));
prop.put("remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true));
@@ -4,6 +4,7 @@
"itemsperpage": "#[itemsperpage]#",
"totalcount": "#[totalcount]#",
"localResourceSize": "#[localResourceSize]#",
"localIndexCount": "#[localIndexCount]#",
"remoteResourceSize": "#[remoteResourceSize]#",
"remoteIndexCount": "#[remoteIndexCount]#",
"remotePeerCount": "#[remotePeerCount]#",
@@ -3192,10 +3192,9 @@ The following words are stop-words and had been excluded from the search:==以
No Results.==未找到.
length of search words must be at least 3 characters==搜索关键字至少为3个字符
> of==> 共
g> local,==g> 本地,
#g> remote),==g> remote),
> from==> 来自
remote YaCy peers.==远端YaCy peer.
> local,==> 本地,
remote from==远端 来自
YaCy peers).==YaCy peer).
#-----------------------------
#File: yacysearchitem.html
@@ -3757,10 +3757,9 @@ and contributors, CC-BY-SA==und Mitwirkenden, CC-BY-SA Lizenz
>Media<==>Medium<
#>URL<==>URL<
> of==> aus
g> local,==g> lokal,
#g> remote),==g> remote),
> from==> von
remote YaCy peers.==remote YaCy Peers.
> local,==> lokal,
remote from==remote von
YaCy peers).==YaCy Peers).
#-----------------------------
#File: yacysearchitem.html
@@ -2464,10 +2464,9 @@ Use the RSS search result format to add static searches to your RSS reader, if y
No Results.==Pas de r&eacute;sultats.
length of search words must be at least 1 character==les termes recherch&eacute;s doivent contenir au moins un caract&egrave;re
> of <==> de <
local, == locaux,
remote), == distants),
> from <==> de <
remote YaCy peers.== noeuds YaCy distants.
> local,==> locaux,
remote from== distants de
YaCy peers).== noeuds YaCy).
Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function==La recherche avec ce noeud est d&eacute;sactiv&eacute;e pour les utilisateurs non autoris&eacute;s. Veuillez vous <a href="Status.html?login=">connecter</a> en tant qu'administrateur pour utiliser la fonction de recherche.
Illegal URL mask:==Masque d'URL incorrect :
(not a valid regular expression), mask ignored.==(expression r&eacute;guli&egrave;re incorrecte), masque ignor&eacute;.
@@ -1470,10 +1470,9 @@ and contributors, CC-BY-SA==そしてコントリビューター, CC-BY-SA
>Media<==>メディア<
#>URL<==>URL<
> of==> of
g> local,==g> ローカル,
#g> remote),==g> リモート),
> from==> from
remote YaCy peers.==リモートのYaCy ピア.
> local,==> ローカル,
remote from==リモート from
YaCy peers).==のYaCy ピア).
#-----------------------------
#File: yacysearchitem.html
@@ -11526,16 +11526,13 @@
<source>&gt; of</source>
</trans-unit>
<trans-unit id="2b6efdaa" xml:space="preserve" approved="no" translate="yes">
<source>g&gt; local,</source>
<source>&gt; local,</source>
</trans-unit>
<trans-unit id="7bc93532" xml:space="preserve" approved="no" translate="yes">
<source>g&gt; remote),</source>
</trans-unit>
<trans-unit id="6bbf7e4c" xml:space="preserve" approved="no" translate="yes">
<source>&gt; from</source>
<source>remote from</source>
</trans-unit>
<trans-unit id="61f1c6c5" xml:space="preserve" approved="no" translate="yes">
<source>remote YaCy peers.</source>
<source>YaCy peers).</source>
</trans-unit>
<trans-unit id="9ddb2d96" xml:space="preserve" approved="no" translate="yes">
<source>&gt;search&lt;</source>
@@ -4087,10 +4087,9 @@ and contributors, CC-BY-SA==и участники, лицензия CC-BY-SA
>Media<==>Медиа<
#>URL<==>URL-адрес<
> of==> из
g> local,==g> локально,
g> remote),==g> удалённо),
> from==> из
remote YaCy peers.==удалённых узлов YaCy.
> local,==> локально,
remote from==удалённо из
YaCy peers).==узлов YaCy).
>search<==>Поиск<
#-----------------------------
@@ -3408,10 +3408,9 @@ length of search words must be at least==Довжина пошукового з
d+ characters==d+ знаків
> of==> з
g> local,==g> локально,
g> remote),==g> віддалених),
> from==> з
remote YaCy peers.==віддалених вузлів YaCy.
> local,==> локально,
remote from==віддалених з
YaCy peers).==вузлів YaCy).
#-----------------------------
#File: yacysearchitem.html

0 comments on commit 30c2f50

Please sign in to comment.