since the solr index is now used for all pages that are indexed locally,

there is no need for the RWI index if the index is not transfered to
another peer. Therefore the creation of RWI index data is now suppressed
if DHT is disabled. This applies for all intranet and portal mode
configurations, but not for public robinson modes. A robinson may switch
back to public mode and then transmit its data. That means if someone
wants to switch never to DHT mode, it would be more appropriate to
choose the portal mode.
pull/1/head
Michael Peter Christen 13 years ago
parent 554db5608b
commit bd769de604

@ -235,7 +235,7 @@ public class ConfigNetwork_p
prop.putHTML("network.unit.name", sb.getConfig(SwitchboardConstants.NETWORK_NAME, "")); prop.putHTML("network.unit.name", sb.getConfig(SwitchboardConstants.NETWORK_NAME, ""));
prop.putHTML("network.unit.description", sb.getConfig("network.unit.description", "")); prop.putHTML("network.unit.description", sb.getConfig("network.unit.description", ""));
prop.putHTML("network.unit.domain", sb.getConfig(SwitchboardConstants.NETWORK_DOMAIN, "")); prop.putHTML("network.unit.domain", sb.getConfig(SwitchboardConstants.NETWORK_DOMAIN, ""));
prop.putHTML("network.unit.dht", sb.getConfig("network.unit.dht", "")); prop.putHTML("network.unit.dht", sb.getConfig(SwitchboardConstants.DHT_ENABLED, ""));
networkBootstrapLocations.remove(sb.getConfig("network.unit.definition", "")); networkBootstrapLocations.remove(sb.getConfig("network.unit.definition", ""));
int c = 0; int c = 0;
for ( final String s : networkBootstrapLocations ) { for ( final String s : networkBootstrapLocations ) {

@ -1177,7 +1177,7 @@ public final class Switchboard extends serverSwitch
ClientIdentification.generateYaCyBot(getConfig(SwitchboardConstants.NETWORK_NAME, "") ClientIdentification.generateYaCyBot(getConfig(SwitchboardConstants.NETWORK_NAME, "")
+ (isRobinsonMode() ? "-" : "/") + (isRobinsonMode() ? "-" : "/")
+ getConfig(SwitchboardConstants.NETWORK_DOMAIN, "global")); + getConfig(SwitchboardConstants.NETWORK_DOMAIN, "global"));
if ( !getConfigBool("network.unit.dht", false) if ( !getConfigBool(SwitchboardConstants.DHT_ENABLED, false)
&& getConfig("network.unit.tenant.agent", "").length() > 0 ) { && getConfig("network.unit.tenant.agent", "").length() > 0 ) {
newagent = getConfig("network.unit.tenant.agent", "").trim(); newagent = getConfig("network.unit.tenant.agent", "").trim();
this.log.logInfo("new user agent: '" + newagent + "'"); this.log.logInfo("new user agent: '" + newagent + "'");
@ -2600,7 +2600,8 @@ public final class Switchboard extends serverSwitch
document, document,
condenser, condenser,
searchEvent, searchEvent,
sourceName); sourceName,
getConfigBool(SwitchboardConstants.DHT_ENABLED, false));
final RSSFeed feed = final RSSFeed feed =
EventChannel.channels(queueEntry.initiator() == null EventChannel.channels(queueEntry.initiator() == null
? EventChannel.PROXY ? EventChannel.PROXY
@ -2980,7 +2981,7 @@ public final class Switchboard extends serverSwitch
if ( this.peers.noDHTActivity() ) { if ( this.peers.noDHTActivity() ) {
return "no DHT distribution: network too small"; return "no DHT distribution: network too small";
} }
if ( !getConfigBool("network.unit.dht", true) ) { if ( !getConfigBool(SwitchboardConstants.DHT_ENABLED, true) ) {
return "no DHT distribution: disabled by network.unit.dht"; return "no DHT distribution: disabled by network.unit.dht";
} }
if ( getConfig(SwitchboardConstants.INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false") ) { if ( getConfig(SwitchboardConstants.INDEX_DIST_ALLOW, "false").equalsIgnoreCase("false") ) {

@ -282,6 +282,8 @@ public final class SwitchboardConstants {
public static final String CLUSTER_MODE_PRIVATE_PEER = "privatepeer"; public static final String CLUSTER_MODE_PRIVATE_PEER = "privatepeer";
public static final String CLUSTER_PEERS_IPPORT = "cluster.peers.ipport"; public static final String CLUSTER_PEERS_IPPORT = "cluster.peers.ipport";
public static final String DHT_ENABLED = "network.unit.dht";
public static final String DHT_BURST_ROBINSON = "network.unit.dht.burst.robinson"; public static final String DHT_BURST_ROBINSON = "network.unit.dht.burst.robinson";
public static final String DHT_BURST_MULTIWORD = "network.unit.dht.burst.multiword"; public static final String DHT_BURST_MULTIWORD = "network.unit.dht.burst.multiword";

@ -177,7 +177,8 @@ public class DocumentIndex extends Segment {
document, document,
condenser, condenser,
null, null,
DocumentIndex.class.getName() + ".add"); DocumentIndex.class.getName() + ".add",
false);
} }
return rows; return rows;
} }

@ -351,7 +351,8 @@ public class Segment {
final Document document, final Document document,
final Condenser condenser, final Condenser condenser,
final SearchEvent searchEvent, final SearchEvent searchEvent,
final String sourceName final String sourceName,
final boolean storeToRWI
) { ) {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
@ -411,59 +412,61 @@ public class Segment {
final int urlComps = MultiProtocolURI.urlComps(url.toString()).length; final int urlComps = MultiProtocolURI.urlComps(url.toString()).length;
// create a word prototype which is re-used for all entries // create a word prototype which is re-used for all entries
final int len = (document == null) ? urlLength : document.dc_title().length(); if ((this.termIndex != null && storeToRWI) || searchEvent != null) {
final WordReferenceRow ientry = new WordReferenceRow( final int len = (document == null) ? urlLength : document.dc_title().length();
url.hash(), final WordReferenceRow ientry = new WordReferenceRow(
urlLength, urlComps, len, url.hash(),
condenser.RESULT_NUMB_WORDS, urlLength, urlComps, len,
condenser.RESULT_NUMB_SENTENCES, condenser.RESULT_NUMB_WORDS,
modDate.getTime(), condenser.RESULT_NUMB_SENTENCES,
System.currentTimeMillis(), modDate.getTime(),
UTF8.getBytes(language), System.currentTimeMillis(),
docType, UTF8.getBytes(language),
outlinksSame, outlinksOther); docType,
outlinksSame, outlinksOther);
// iterate over all words of content text
Word wprop = null; // iterate over all words of content text
byte[] wordhash; Word wprop = null;
String word; byte[] wordhash;
for (Map.Entry<String, Word> wentry: condenser.words().entrySet()) { String word;
word = wentry.getKey(); for (Map.Entry<String, Word> wentry: condenser.words().entrySet()) {
wprop = wentry.getValue(); word = wentry.getKey();
assert (wprop.flags != null); wprop = wentry.getValue();
ientry.setWord(wprop); assert (wprop.flags != null);
wordhash = Word.word2hash(word); ientry.setWord(wprop);
wordhash = Word.word2hash(word);
if (this.termIndex != null && storeToRWI) try {
this.termIndex.add(wordhash, ientry);
} catch (final Exception e) {
Log.logException(e);
}
wordCount++;
// during a search event it is possible that a heuristic is used which aquires index
// data during search-time. To transfer indexed data directly to the search process
// the following lines push the index data additionally to the search process
// this is done only for searched words
if (searchEvent != null && !searchEvent.getQuery().query_exclude_hashes.has(wordhash) && searchEvent.getQuery().query_include_hashes.has(wordhash)) {
// if the page was added in the context of a heuristic this shall ensure that findings will fire directly into the search result
ReferenceContainer<WordReference> container;
try {
container = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, wordhash, 1);
container.add(ientry);
rankingProcess.add(container, true, sourceName, -1, 5000);
} catch (final SpaceExceededException e) {
continue;
}
}
}
if (rankingProcess != null) rankingProcess.addFinalize();
// assign the catchall word
ientry.setWord(wprop == null ? catchallWord : wprop); // we use one of the word properties as template to get the document characteristics
if (this.termIndex != null) try { if (this.termIndex != null) try {
this.termIndex.add(wordhash, ientry); this.termIndex.add(catchallHash, ientry);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }
wordCount++;
// during a search event it is possible that a heuristic is used which aquires index
// data during search-time. To transfer indexed data directly to the search process
// the following lines push the index data additionally to the search process
// this is done only for searched words
if (searchEvent != null && !searchEvent.getQuery().query_exclude_hashes.has(wordhash) && searchEvent.getQuery().query_include_hashes.has(wordhash)) {
// if the page was added in the context of a heuristic this shall ensure that findings will fire directly into the search result
ReferenceContainer<WordReference> container;
try {
container = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, wordhash, 1);
container.add(ientry);
rankingProcess.add(container, true, sourceName, -1, 5000);
} catch (final SpaceExceededException e) {
continue;
}
}
}
if (rankingProcess != null) rankingProcess.addFinalize();
// assign the catchall word
ientry.setWord(wprop == null ? catchallWord : wprop); // we use one of the word properties as template to get the document characteristics
if (this.termIndex != null) try {
this.termIndex.add(catchallHash, ientry);
} catch (final Exception e) {
Log.logException(e);
} }
// STORE PAGE REFERENCES INTO CITATION INDEX // STORE PAGE REFERENCES INTO CITATION INDEX

Loading…
Cancel
Save