Skip to content
Permalink
Browse files

Improve accuracy of total results count on latest pages in Stealth mode

Previously, when mixing results from local RWI and local Solr (Stealth
mode), total local Solr count could be ignored on last result pages,
when the page offset was higher than local Solr count but lower than
total RWI count.
  • Loading branch information...
luccioman committed Mar 4, 2019
1 parent 6e9d5f6 commit 384c37102cbd87fdb7bcb17fea48e9822c8f51fb
Showing with 7 additions and 2 deletions.
  1. +7 −2 source/net/yacy/peers/Protocol.java
@@ -1342,8 +1342,14 @@ protected static int solrQuery(
}

// evaluate result
if (docList == null || docList[0].size() == 0) {
final int numFound = (int) docList[0].getNumFound();
if (docList == null || docList[0].isEmpty()) {
Network.log.info("SEARCH (solr), returned 0 out of 0 documents from " + (target == null ? "shard" : ("peer " + target.hash + ":" + target.getName())) + " query = " + solrQuery.toString()) ;
if(localsearch && offset > 0) {
/* No documents were returned from Solr because the offset is too high, but we have to keep the total number of matching documents for accurate pagination.
* This case can notably happen on latest results pages, when mixing results from local RWI and local Solr ("Stealth Mode") */
event.local_solr_stored.set(numFound);
}
return 0;
}

@@ -1427,7 +1433,6 @@ protected static int solrQuery(
// add the url entry to the checked results
resultContainer.add(urlEntry);
}
final int numFound = (int) docList[0].getNumFound();
docList[0].clear();
docList[0] = null;
if (localsearch) {

0 comments on commit 384c371

Please sign in to comment.
You can’t perform that action at this time.