lazy initialization of block rank table ... only normal web search uses

this. When interactive search or location search is used, the block rank
is switched off
pull/1/head
Michael Peter Christen 13 years ago
parent ba10caf89a
commit dd14b19c26

@ -34,6 +34,7 @@ import net.yacy.cora.document.Classification.ContentDomain;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.ranking.BlockRank;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -42,6 +43,7 @@ public class index {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
BlockRank.ensureLoaded(); // lazy initialization of block rank tables
final String forwardTarget = sb.getConfig(SwitchboardConstants.INDEX_FORWARD, "");
if (forwardTarget.length() > 0) {

@ -9,7 +9,7 @@
// $LastChangedBy$
//
// LICENSE
//
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
@ -27,7 +27,6 @@
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.ranking.BlockRank;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -38,8 +37,7 @@ public class yacyinteractive {
public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
BlockRank.ensureLoaded();
prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0);
final String promoteSearchPageGreeting =
(env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) ?

@ -78,7 +78,6 @@ import net.yacy.search.query.AccessTracker;
import net.yacy.search.query.QueryParams;
import net.yacy.search.query.SearchEvent;
import net.yacy.search.query.SearchEventCache;
import net.yacy.search.ranking.BlockRank;
import net.yacy.search.ranking.RankingProfile;
import de.anomic.data.DidYouMean;
import de.anomic.data.UserDB;
@ -97,7 +96,6 @@ public class yacysearch {
final Switchboard sb = (Switchboard) env;
sb.localSearchLastAccess = System.currentTimeMillis();
BlockRank.ensureLoaded();
final boolean searchAllowed =
sb.getConfigBool("publicSearchpage", true) || sb.verifyAuthentication(header);

@ -31,7 +31,6 @@ import net.yacy.document.LibraryProvider;
import net.yacy.document.geolocalization.GeoLocation;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.ranking.BlockRank;
import de.anomic.server.serverCore;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -41,8 +40,7 @@ public class yacysearch_location {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
BlockRank.ensureLoaded();
prop.put("kml", 0);
if (header.get(HeaderFramework.CONNECTION_PROP_EXT, "").equals("kml") ||

@ -106,6 +106,7 @@ public class BlockRank {
this.seed = seed;
}
@Override
public void run() {
final ReferenceContainerCache<HostReference> partialIndex = Protocol.loadIDXHosts(this.seed);
if (partialIndex == null || partialIndex.size() == 0) return;
@ -247,7 +248,7 @@ public class BlockRank {
rankingPath = rankingPath0;
count = count0;
}
public static void ensureLoaded() {
if (ybrTables != null) return;
ybrTables = new BinSearch[count];
@ -296,7 +297,6 @@ public class BlockRank {
* @return
*/
public static int ranking(final byte[] hash) {
ensureLoaded();
return ranking(hash, ybrTables);
}

Loading…
Cancel
Save