more fixes to search result page navigation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6575 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 1375d0214d
commit 5d930c96f0

@ -280,7 +280,7 @@ public final class search {
theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, null, true); theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, null, true);
// set statistic details of search result and find best result index set // set statistic details of search result and find best result index set
if (theSearch.getRankingResult().getLocalResourceSize() == 0) { if (theSearch.getRankingResult().getLocalIndexCount() == 0) {
prop.put("indexcount", ""); prop.put("indexcount", "");
prop.put("joincount", "0"); prop.put("joincount", "0");
} else { } else {
@ -304,11 +304,11 @@ public final class search {
} }
prop.put("indexcount", indexcount.toString()); prop.put("indexcount", indexcount.toString());
if (theSearch.getRankingResult().getLocalResourceSize() == 0) { if (theSearch.getRankingResult().getLocalIndexCount() == 0) {
joincount = 0; joincount = 0;
prop.put("joincount", "0"); prop.put("joincount", "0");
} else { } else {
joincount = theSearch.getRankingResult().getLocalResourceSize(); joincount = theSearch.getRankingResult().getLocalIndexCount();
prop.put("joincount", Integer.toString(joincount)); prop.put("joincount", Integer.toString(joincount));
accu = theSearch.result().completeResults(3000); accu = theSearch.result().completeResults(3000);
} }
@ -379,7 +379,7 @@ public final class search {
// prepare search statistics // prepare search statistics
theQuery.remotepeer = sb.peers.lookupByIP(natLib.getInetAddress(client), true, false, false); theQuery.remotepeer = sb.peers.lookupByIP(natLib.getInetAddress(client), true, false, false);
theQuery.resultcount = (theSearch == null) ? 0 : theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(); theQuery.resultcount = (theSearch == null) ? 0 : theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
theQuery.searchtime = System.currentTimeMillis() - timestamp; theQuery.searchtime = System.currentTimeMillis() - timestamp;
theQuery.urlretrievaltime = (theSearch == null) ? 0 : theSearch.result().getURLRetrievalTime(); theQuery.urlretrievaltime = (theSearch == null) ? 0 : theSearch.result().getURLRetrievalTime();
theQuery.snippetcomputationtime = (theSearch == null) ? 0 : theSearch.result().getSnippetComputationTime(); theQuery.snippetcomputationtime = (theSearch == null) ? 0 : theSearch.result().getSnippetComputationTime();

@ -480,6 +480,7 @@ public class yacysearch {
offset = 0; offset = 0;
} }
final SearchEvent theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false); final SearchEvent theSearch = SearchEventCache.getEvent(theQuery, sb.peers, sb.crawlResults, (sb.isRobinsonMode()) ? sb.clusterhashes : null, false);
try {Thread.sleep(100);} catch (InterruptedException e1) {} // wait a little time to get first results in the search
// generate result object // generate result object
//serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms"); //serverLog.logFine("LOCAL_SEARCH", "SEARCH TIME AFTER ORDERING OF SEARCH RESULTS: " + (System.currentTimeMillis() - timestamp) + " ms");
@ -490,11 +491,11 @@ public class yacysearch {
// log // log
Log.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " + Log.logInfo("LOCAL_SEARCH", "EXIT WORD SEARCH: " + theQuery.queryString + " - " +
(theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize()) + " links found, " + (theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize()) + " links found, " +
(System.currentTimeMillis() - timestamp) + " ms"); (System.currentTimeMillis() - timestamp) + " ms");
// prepare search statistics // prepare search statistics
theQuery.resultcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(); theQuery.resultcount = theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
theQuery.searchtime = System.currentTimeMillis() - timestamp; theQuery.searchtime = System.currentTimeMillis() - timestamp;
theQuery.urlretrievaltime = theSearch.result().getURLRetrievalTime(); theQuery.urlretrievaltime = theSearch.result().getURLRetrievalTime();
theQuery.snippetcomputationtime = theSearch.result().getSnippetComputationTime(); theQuery.snippetcomputationtime = theSearch.result().getSnippetComputationTime();
@ -570,13 +571,12 @@ public class yacysearch {
Log.logException(e); Log.logException(e);
} }
final int totalcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
prop.put("num-results_offset", offset); prop.put("num-results_offset", offset);
prop.put("num-results_itemscount", Formatter.number(0, true)); prop.put("num-results_itemscount", Formatter.number(0, true));
prop.put("num-results_itemsPerPage", itemsPerPage); prop.put("num-results_itemsPerPage", itemsPerPage);
prop.put("num-results_totalcount", Formatter.number(totalcount, true)); prop.put("num-results_totalcount", Formatter.number(theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("num-results_globalresults", (globalsearch) ? "1" : "0"); prop.put("num-results_globalresults", (globalsearch) ? "1" : "0");
prop.put("num-results_globalresults_localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalResourceSize(), true)); prop.put("num-results_globalresults_localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
prop.put("num-results_globalresults_remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true)); prop.put("num-results_globalresults_remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true)); prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true)); prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));
@ -591,7 +591,7 @@ public class yacysearch {
resnav.append(QueryParams.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null, navigation)); resnav.append(QueryParams.navurl("html", thispage - 1, display, theQuery, originalUrlMask, null, navigation));
resnav.append("\"><img src=\"env/grafics/navdl.gif\" width=\"16\" height=\"16\"></a>&nbsp;"); resnav.append("\"><img src=\"env/grafics/navdl.gif\" width=\"16\" height=\"16\"></a>&nbsp;");
} }
final int numberofpages = Math.min(10, Math.max(thispage + 1, totalcount / theQuery.displayResults())); final int numberofpages = Math.min(10, Math.max(1 + thispage, 1 + ((theSearch.getRankingResult().getLocalIndexCount() < 11) ? theSearch.getRankingResult().getLocalResourceSize() : theSearch.getRankingResult().getLocalIndexCount()) / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) { for (int i = 0; i < numberofpages; i++) {
if (i == thispage) { if (i == thispage) {
resnav.append("<img src=\"env/grafics/navs"); resnav.append("<img src=\"env/grafics/navs");
@ -614,7 +614,7 @@ public class yacysearch {
} }
String resnavs = resnav.toString(); String resnavs = resnav.toString();
prop.put("num-results_resnav", resnavs); prop.put("num-results_resnav", resnavs);
prop.put("pageNavBottom", (totalcount - offset > 6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom prop.put("pageNavBottom", (theSearch.getRankingResult().getLocalIndexCount() - offset > 6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom
prop.put("pageNavBottom_resnav", resnavs); prop.put("pageNavBottom_resnav", resnavs);
// generate the search result lines; the content will be produced by another servlet // generate the search result lines; the content will be produced by another servlet

@ -86,12 +86,12 @@ public class yacysearchitem {
final QueryParams theQuery = theSearch.getQuery(); final QueryParams theQuery = theSearch.getQuery();
// dynamically update count values // dynamically update count values
final int totalcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(); final int totalcount = theSearch.getRankingResult().getLocalIndexCount() + theSearch.getRankingResult().getRemoteResourceSize();
final int offset = theQuery.neededResults() - theQuery.displayResults() + 1; final int offset = theQuery.neededResults() - theQuery.displayResults() + 1;
prop.put("offset", offset); prop.put("offset", offset);
prop.put("itemscount", Formatter.number(Math.min((item < 0) ? theQuery.neededResults() : item + 1, totalcount))); prop.put("itemscount", Formatter.number(Math.min((item < 0) ? theQuery.neededResults() : item + 1, totalcount)));
prop.put("totalcount", Formatter.number(totalcount, true)); prop.put("totalcount", Formatter.number(totalcount, true));
prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalResourceSize(), true)); prop.put("localResourceSize", Formatter.number(theSearch.getRankingResult().getLocalIndexCount(), true));
prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true)); prop.put("remoteResourceSize", Formatter.number(theSearch.getRankingResult().getRemoteResourceSize(), true));
prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true)); prop.put("remoteIndexCount", Formatter.number(theSearch.getRankingResult().getRemoteIndexCount(), true));
prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true)); prop.put("remotePeerCount", Formatter.number(theSearch.getRankingResult().getRemotePeerCount(), true));

@ -137,7 +137,7 @@ public class yacysearchtrailer {
String aboutBody = env.getConfig("about.body", ""); String aboutBody = env.getConfig("about.body", "");
String aboutHeadline = env.getConfig("about.headline", ""); String aboutHeadline = env.getConfig("about.headline", "");
if ((aboutBody.length() == 0 && aboutHeadline.length() == 0) || if ((aboutBody.length() == 0 && aboutHeadline.length() == 0) ||
theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getLocalIndexCount() +
theSearch.getRankingResult().getRemoteResourceSize() == 0) { theSearch.getRankingResult().getRemoteResourceSize() == 0) {
prop.put("nav-about", 0); prop.put("nav-about", 0);
} else { } else {

@ -73,7 +73,8 @@ public final class RankingProcess extends Thread {
//private final int[] domZones; //private final int[] domZones;
private HashMap<byte[], ReferenceContainer<WordReference>> localSearchInclusion; private HashMap<byte[], ReferenceContainer<WordReference>> localSearchInclusion;
private int remote_peerCount, remote_indexCount, remote_resourceSize, local_resourceSize; private int remote_resourceSize, remote_indexCount, remote_peerCount;
private int local_resourceSize, local_indexCount;
private final SortStack<WordReferenceVars> stack; private final SortStack<WordReferenceVars> stack;
private int feeders; private int feeders;
private final ConcurrentHashMap<String, SortStack<WordReferenceVars>> doubleDomCache; // key = domhash (6 bytes); value = like stack private final ConcurrentHashMap<String, SortStack<WordReferenceVars>> doubleDomCache; // key = domhash (6 bytes); value = like stack
@ -96,9 +97,10 @@ public final class RankingProcess extends Thread {
this.order = order; this.order = order;
this.maxentries = maxentries; this.maxentries = maxentries;
this.remote_peerCount = 0; this.remote_peerCount = 0;
this.remote_indexCount = 0;
this.remote_resourceSize = 0; this.remote_resourceSize = 0;
this.remote_indexCount = 0;
this.local_resourceSize = 0; this.local_resourceSize = 0;
this.local_indexCount = 0;
this.urlhashes = new ConcurrentHashMap<String, Long>(0, 0.75f, concurrency); this.urlhashes = new ConcurrentHashMap<String, Long>(0, 0.75f, concurrency);
this.misses = new TreeSet<String>(); this.misses = new TreeSet<String>();
this.flagcount = new int[32]; this.flagcount = new int[32];
@ -140,7 +142,7 @@ public final class RankingProcess extends Thread {
return; return;
} }
add(index, true, index.size()); add(index, true, -1);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }
@ -153,8 +155,9 @@ public final class RankingProcess extends Thread {
assert (index != null); assert (index != null);
if (index.isEmpty()) return; if (index.isEmpty()) return;
if (local) { if (local) {
this.local_resourceSize += fullResource; this.local_resourceSize += index.size();
} else { } else {
this.remote_resourceSize += fullResource; this.remote_resourceSize += fullResource;
this.remote_peerCount++; this.remote_peerCount++;
@ -229,7 +232,7 @@ public final class RankingProcess extends Thread {
filteredEntries.add(iEntry); filteredEntries.add(iEntry);
// increase counter for statistics // increase counter for statistics
if (!local) this.remote_indexCount++; if (local) this.local_indexCount++; else this.remote_indexCount++;
} }
// do the ranking // do the ranking
@ -487,24 +490,29 @@ public final class RankingProcess extends Thread {
return this.stack.size(); return this.stack.size();
} }
public int getLocalIndexCount() {
// the number of results in the local peer after filtering
return this.local_indexCount;
}
public int getLocalResourceSize() {
// the number of hits in the local peer (index size, size of the collection in the own index)
return this.local_resourceSize;
}
public int getRemoteIndexCount() { public int getRemoteIndexCount() {
// the number of result contributions from all the remote peers // the number of result contributions from all the remote peers
return this.remote_indexCount; return this.remote_indexCount;
} }
public int getRemotePeerCount() {
// the number of remote peers that have contributed
return this.remote_peerCount;
}
public int getRemoteResourceSize() { public int getRemoteResourceSize() {
// the number of all hits in all the remote peers // the number of all hits in all the remote peers
return this.remote_resourceSize; return this.remote_resourceSize;
} }
public int getLocalResourceSize() { public int getRemotePeerCount() {
// the number of hits in the local peer (index size, size of the collection in the own index) // the number of remote peers that have contributed
return this.local_resourceSize; return this.remote_peerCount;
} }
public void remove(final WordReferenceVars reference) { public void remove(final WordReferenceVars reference) {

Loading…
Cancel
Save