fix: display and calculate authors and namespace search navigator if configured (otherwise skip overhead)

(leave hosts, topics and  not in ConfigPortal included filetype,  protocoll navigator untouched)
pull/1/head
reger 12 years ago
parent c54cb85422
commit 469efcdb9d

@ -154,8 +154,18 @@ public final class SearchEvent {
this.maxExpectedRemoteReferences = new AtomicInteger(0);
this.expectedRemoteReferences = new AtomicInteger(0);
// prepare configured search navigation
final String navcfg = Switchboard.getSwitchboard().getConfig("search.navigation", "");
if (navcfg.contains("authors")) {
this.authorNavigator = new ConcurrentScoreMap<String>();
} else {
this.authorNavigator = null;
}
if (navcfg.contains("namespace")) {
this.namespaceNavigator = new ConcurrentScoreMap<String>();
} else {
this.namespaceNavigator = null;
}
this.protocolNavigator = new ConcurrentScoreMap<String>();
this.filetypeNavigator = new ConcurrentScoreMap<String>();
this.snippets = new ConcurrentHashMap<String, String>();
@ -470,12 +480,15 @@ public final class SearchEvent {
ReversibleScoreMap<String> fcts = facets.get(YaCySchema.host_s.getSolrFieldName());
if (fcts != null) this.rankingProcess.hostNavigator.inc(fcts);
if (this.filetypeNavigator != null) {
fcts = facets.get(YaCySchema.url_file_ext_s.getSolrFieldName());
if (fcts != null) this.filetypeNavigator.inc(fcts);
}
if (this.protocolNavigator != null) {
fcts = facets.get(YaCySchema.url_protocol_s.getSolrFieldName());
if (fcts != null) this.protocolNavigator.inc(fcts);
}
//fcts = facets.get(YaCySchema.author.getSolrFieldName());
//if (fcts != null) this.authorNavigator.inc(fcts);
@ -823,7 +836,7 @@ public final class SearchEvent {
}
// add author to the author navigator
this.authorNavigator.inc(pageauthor);
if (this.authorNavigator != null) this.authorNavigator.inc(pageauthor);
} else if ( this.query.authorhash != null ) {
this.query.misses.add(page.hash());
continue;
@ -838,15 +851,17 @@ public final class SearchEvent {
// from here: collect navigation information
// namespace navigation
if (this.namespaceNavigator != null) {
String pagepath = page.url().getPath();
if ( (p = pagepath.indexOf(':')) >= 0 ) {
if ((p = pagepath.indexOf(':')) >= 0) {
pagepath = pagepath.substring(0, p);
p = pagepath.lastIndexOf('/');
if ( p >= 0 ) {
if (p >= 0) {
pagepath = pagepath.substring(p + 1);
this.namespaceNavigator.inc(pagepath);
}
}
}
return page; // accept url
}

Loading…
Cancel
Save