fix configuration for search page navigators

- added additional config page (ConfigSearchPage_p) for easy setup of search page layout (to not overload ConfigPortal page)
   - currently redundant setting with part of ConfigPortal page
- added missing config for filetype and protocol navigator
- adjusted init of SearchEvent to check navigation config setting
- renamed RankigProcess.getTopicNavigator to getTopics (to distiguish between added SearchEvent.getTopicNavigator)
pull/1/head
reger 12 years ago
parent 24db2fcd9d
commit f143804382

@ -0,0 +1,235 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>YaCy '#[clientname]#': Search Page</title>
#%env/templates/metas.template%#
<link rel="stylesheet" type="text/css" media="screen" href="/env/highslide.css" />
<script type="text/javascript" src="/js/yacysearch.js"></script>
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
<script type="text/javascript">hs.outlineType = 'rounded-white';</script>
<script src="/yacy/ui/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/yacy/ui/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
<script src="/yacy/ui/js/jquery.tagcloud.min.js" type="text/javascript"></script>
<script src="/yacy/ui/js/jquery.tinysort.min.js" type="text/javascript"></script>
<link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.base.css" rel="stylesheet" />
<link media="screen" type="text/css" href="/yacy/ui/css/themes/start/ui.theme.css" rel="stylesheet" />
<link media="screen" type="text/css" href="/yacy/ui/css/autocomplete.css" rel="stylesheet" />
</head>
<body id="ConfigSearchPage" >
#%env/templates/header.template%#
#%env/templates/submenuSearchConfiguration.template%#
<script type="text/javascript">
//<![CDATA[
$(function() {
$.extend($.ui.accordion.defaults, {
autoHeight: false,
clearStyle: true,
collapsible: true,
header: "h3"
});
$("#sidebar#[vocabulary]#").accordion({});
$("#sidebarDomains").accordion({});
$("#sidebarProtocols").accordion({});
$("#sidebarFiletypes").accordion({});
$("#sidebarAuthors").accordion({});
$("#sidebarLanguages").accordion({});
$("#sidebarNameSpace").accordion({});
$("#sidebarTopics").tagcloud({type:"sphere",power:.25,seed:0,sizemin:10,sizemax:20,height:80,colormin:"682",colormax:"20C"}).find("li").tsort();
$("#sidebarAbout").accordion({});
});
//]]>
</script>
<h2>Search Result Page Layout Configuration</h2>
<p>
Below is a generic template of the search result page. Mark the check boxes for features you would like to be displayed.
To change colors and styles use the <a href="ConfigAppearance_p.html">Appearance</a> menu for different skins and languages.
Other portal settings can be adjusted in <a href="ConfigPortal.html">Generic Search Portal</a> menu.
</p>
<h4>Page Template</h4>
<form action="ConfigSearchPage_p.html" method="post" enctype="multipart/form-data" id="ConfigSearchPage" accept-charset="UTF-8">
<table>
<tr>
<td style="border-width: 1px; border-color: grey; border-style: solid; padding: 5px;">
<table width="90%">
<tr>
<td valign="top"><input type="checkbox" name="publicTopmenu" value="true" #(publicTopmenu)#::checked="checked" #(/publicTopmenu)# /></td>
<td><div class="SubMenu">
<ul class="SubMenu">
<li style="width: 15%;"><a href="/Status.html" target="LayouTest" class="MenuItemLink">Administration</a></li>
<li style="width: 15%;"><a href="/index.html" target="LayouTest" class="MenuItemLink">Web Search</a></li>
<li style="width: 15%;"><a href="/yacyinteractive.html" target="LayouTest" class="MenuItemLink">File Search</a></li>
<li style="width: 15%;"><a href="/HostBrowser.html?hosts=" target="LayouTest" class="MenuItemLink">HostBrowser</a></li>
<li style="width: 15%;"><a href="/ViewProfile.html?hash=localhash" target="LayouTest" class="MenuItemLink">About Us</a></li>
<li style="width: 15%;"><a href="http://www.yacy-websearch.net/wiki/" target="LayouTest" class="MenuItemLink">Help / YaCy Wiki</a></li>
</ul>
</div></td>
</tr>
</table>
<h2>#[promoteSearchPageGreeting]#</h2>
<div class="yacylogo">
<a href="#[promoteSearchPageGreeting.homepage]#" target="LayouTest" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" /></a>
</div>
<div style="width: 550px; float: left;">
<fieldset class="yacys">
<input id="search" class="searchinput" name="query" type="text" size="40" maxlength="80" value="search words" />
<input id="Enter" type="button" name="Enter" value="Search" onclick="var w = window.open('yacysearch.html','LayoutTest'); w.focus();" />
<div class="yacysearch">
<input type="checkbox" id="text" name="search.text" value="true" #(search.text)#::checked="checked" #(/search.text)# /><label for="text">Text</label>
&nbsp;&nbsp;<input type="checkbox" id="image" name="search.image" value="true" #(search.image)#::checked="checked" #(/search.image)# /><label for="image">Images</label>
&nbsp;&nbsp;<input type="checkbox" id="audio" name="search.audio" value="true" #(search.audio)#::checked="checked" #(/search.audio)# /><label for="audio">Audio</label>
&nbsp;&nbsp;<input type="checkbox" id="video" name="search.video" value="true" #(search.video)#::checked="checked" #(/search.video)# /><label for="video">Video</label>
&nbsp;&nbsp;<input type="checkbox" id="app" name="search.app" value="true" #(search.app)#::checked="checked" #(/search.app)# /><label for="app">Applications</label>
&nbsp;<input type="checkbox" id="options" name="search.options" value="true" #(search.options)#::checked="checked" #(/search.options)# /><a href="" target="LayouTest">more options</a>
</div>
</fieldset>
</div>
<!-- the sidebar navigation -->
<div style="float: right; width: 27%;">
<fieldset>
<table>
<tr>
<td><input type="checkbox" name="search.navigation.topics" value="true" #(search.navigation.topics)#::checked="checked" #(/search.navigation.topics)# /></td>
<td>
<div style="float: right; margin-top: 0px; width: 100%; height: 80px">
<div>
<ul id="sidebarTopics" style="padding-left: 0px;">
<li value="3"><a href="yacysearch.html" target="LayouTest">Tag</a></li>
<li value="4"><a href="yacysearch.html" target="LayouTest">Topics</a></li>
<li value="3"><a href="yacysearch.html" target="LayouTest">Cloud</a></li>
<li value="2"><a href="yacysearch.html" target="LayouTest">Topics</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Cloud</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Tag</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Cloud</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Topic</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Tag</a></li>
<li value="1"><a href="yacysearch.html" target="LayouTest">Cloud</a></li>
</ul>
</div>
</div>
</td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.protocol" value="true" #(search.navigation.protocol)#::checked="checked" #(/search.navigation.protocol)# /></td>
<td><div id="sidebarProtocols" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Protocol Navigator</h3>
</div></td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.filetype" value="true" #(search.navigation.filetype)#::checked="checked" #(/search.navigation.filetype)# /></td>
<td><div id="sidebarFiletypes" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Filetype Navigator</h3>
</div></td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.hosts" value="true" #(search.navigation.hosts)#::checked="checked" #(/search.navigation.hosts)# /></td>
<td><div id="sidebarDomains" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Domain Navigator</h3>
</div></td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.namespace" value="true" #(search.navigation.namespace)#::checked="checked" #(/search.navigation.namespace)# /></td>
<td><div id="sidebarNameSpace" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Wiki Name Space Navigator</h3>
</div></td>
</tr>
<tr>
<td><input type="checkbox" name="search.navigation.authors" value="true" #(search.navigation.authors)#::checked="checked" #(/search.navigation.authors)# /></td>
<td><div id="sidebarAuthors" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Author Navigator</h3>
</div></td>
</tr>
<tr>
<td></td>
<td><div id="vocabulary" style="float: right; margin-top: 0px; width: 210px;">
<h3 style="padding-left: 25px;">Vocabulary Navigator</h3>
</div></td>
</tr>
<tr>
<td></td>
<td><div id="sidebarAbout" style="float: right; margin-top: 5px; width: 210px;">
<h3 style="padding-left: 25px;">about#[about.headline]#</h3>
<div>#[about.body]#</div>
</div></td>
</tr>
</table>
</fieldset>
</div>
<!-- the search result -->
<div style="float: left; width: 70%;">
<fieldset>
<div class="searchresults">
<h4 class="linktitle">
<img width="16" height="16" src="env/grafics/dfltfvcn.ico" class="favicon" alt="" />
<a href="yacysearch.html" target="LayouTest">Title of Result</a>
</h4>
<p class="snippet">
<span class="snippetLoaded" id="hhash">Description and text snippet of the search result</span>
</p>
<p class="url">
<a href="yacysearch.html" id="urlhash" target="LayouTest">http://url-of-the-search-result.net</a>
</p>
<p class="urlinfo">
<table border="0">
<tr>
<td width="15px"></td>
<td>#[content_showDate_date]#</td>
<td>&nbsp;|&nbsp;42 kbyte</td>
<td>&nbsp;|&nbsp;<a href="api/yacydoc.html" target="LayouTest" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a></td>
<td>&nbsp;|&nbsp;<a href="ViewFile.html" target="LayouTest">Parser</a></td>
<td>&nbsp;|&nbsp;<a href="yacysearch.html" target="LayouTest">Pictures</a></td>
<td>&nbsp;|&nbsp;<a href="CacheResource_p.html" target="LayouTest">Cache</a></td>
<td>&nbsp;|&nbsp;<a href="proxy.html" target="LayouTest">Augmented Browsing</a></td>
<td>&nbsp;|&nbsp;<a href="HostBrowser.html" target="LayouTest"><img src="/env/grafics/minitree.png" width="15" height="8" /></a></td>
</tr>
<tr>
<td></td>
<td align="center"><input type="checkbox" name="search.result.show.date" value="true" #(search.result.show.date)#::checked="checked" #(/search.result.show.date)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.size" value="true" #(search.result.show.size)#::checked="checked" #(/search.result.show.size)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.metadata" value="true" #(search.result.show.metadata)#::checked="checked" #(/search.result.show.metadata)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.parser" value="true" #(search.result.show.parser)#::checked="checked" #(/search.result.show.parser)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.pictures" value="true" #(search.result.show.pictures)#::checked="checked" #(/search.result.show.pictures)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.cache" value="true" #(search.result.show.cache)#::checked="checked" #(/search.result.show.cache)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.proxy" value="true" #(search.result.show.proxy)#::checked="checked" #(/search.result.show.proxy)# /></td>
<td align="center"><input type="checkbox" name="search.result.show.hostbrowser" value="true" #(search.result.show.hostbrowser)#::checked="checked" #(/search.result.show.hostbrowser)# /></td>
</tr>
<tr>
<td></td>
<td colspan="8"><input type="checkbox" name="search.result.show.tags" value="true" #(search.result.show.tags)#::checked="checked" #(/search.result.show.tags)# />Tags</td>
</tr>
</table>
</p>
</div>
</fieldset>
</div>
</td>
</tr>
<tr>
<td>
<fieldset>
<dt>&nbsp;</dt>
<dd>
<input type="submit" name="searchpage_set" value="Save Settings" class="submitready" />&nbsp;&nbsp;
<input type="submit" name="searchpage_default" value="Set Default Values" class="submitready" />
</dd>
</fieldset>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
//<![CDATA[
$(function() { $("#sidebarProtocols").accordion('activate', false); });
$(function() { $("#sidebarFiletypes").accordion('activate', false); });
$(function() { $("#sidebarDomains").accordion('activate', false); });
$(function() { $("#sidebarNameSpace").accordion('activate', false); });
$(function() { $("#sidebarAuthors").accordion('activate', false); });
$(function() { $("#vocabulary").accordion('activate', false); });
$(function() { $("#sidebarAbout").accordion('activate', false); });
//]]>
</script>
</body>
</html>

@ -0,0 +1,145 @@
// ConfigSearchPage_p.java
// -----------------------
// part of YaCy
// (C) by Michael Peter Christen; mc@yacy.net
// first published on http://yacy.net
// Frankfurt, Germany, 4.7.2008
//
//$LastChangedDate$
//$LastChangedRevision$
//$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
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import java.sql.Date;
import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.WorkTables;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class ConfigSearchPage_p {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env;
if (post != null) {
// AUTHENTICATE
if (!sb.verifyAuthentication(header)) {
// force log-in
prop.authenticationRequired();
return prop;
}
if (post.containsKey("searchpage_set")) {
final String newGreeting = post.get(SwitchboardConstants.GREETING, "");
// store this call as api call
sb.tables.recordAPICall(post, "ConfigPortal.html", WorkTables.TABLE_API_TYPE_CONFIGURATION, "new portal design. greeting: " + newGreeting);
sb.setConfig("publicTopmenu", post.getBoolean("publicTopmenu"));
sb.setConfig("search.options", post.getBoolean("search.options"));
sb.setConfig("search.text", post.getBoolean("search.text"));
sb.setConfig("search.image", post.getBoolean("search.image"));
sb.setConfig("search.audio", post.getBoolean("search.audio"));
sb.setConfig("search.video", post.getBoolean("search.video"));
sb.setConfig("search.app", post.getBoolean("search.app"));
sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date"));
sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size"));
sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata"));
sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser"));
sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures"));
sb.setConfig("search.result.show.cache", post.getBoolean("search.result.show.cache"));
sb.setConfig("search.result.show.proxy", post.getBoolean("search.result.show.proxy"));
sb.setConfig("search.result.show.hostbrowser", post.getBoolean("search.result.show.hostbrowser"));
sb.setConfig("search.result.show.tags", post.getBoolean("search.result.show.tags"));
// construct navigation String
String nav = "";
if (post.getBoolean("search.navigation.filetype")) nav += "filetype,";
if (post.getBoolean("search.navigation.protocol")) nav += "protocol,";
if (post.getBoolean("search.navigation.hosts")) nav += "hosts,";
if (post.getBoolean("search.navigation.authors")) nav += "authors,";
if (post.getBoolean("search.navigation.namespace")) nav += "namespace,";
if (post.getBoolean("search.navigation.topics")) nav += "topics,";
if (nav.endsWith(",")) nav = nav.substring(0, nav.length() - 1);
sb.setConfig("search.navigation", nav);
}
if (post.containsKey("searchpage_default")) {
sb.setConfig("publicTopmenu", true);
sb.setConfig("search.navigation", "hosts,authors,namespace,topics");
sb.setConfig("search.options", true);
sb.setConfig("search.text", true);
sb.setConfig("search.image", true);
sb.setConfig("search.audio", false);
sb.setConfig("search.video", false);
sb.setConfig("search.app", false);
sb.setConfig("search.result.show.date", true);
sb.setConfig("search.result.show.size", false);
sb.setConfig("search.result.show.metadata", false);
sb.setConfig("search.result.show.parser", false);
sb.setConfig("search.result.show.pictures", false);
sb.setConfig("search.result.show.cache", true);
sb.setConfig("search.result.show.proxy", false);
sb.setConfig("search.result.show.hostbrowser", true);
sb.setConfig("search.result.show.tags", false);
}
}
prop.putHTML(SwitchboardConstants.GREETING, sb.getConfig(SwitchboardConstants.GREETING, ""));
prop.putHTML(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, ""));
prop.putHTML(SwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
prop.putHTML(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
prop.putHTML(SwitchboardConstants.INDEX_FORWARD, sb.getConfig(SwitchboardConstants.INDEX_FORWARD, ""));
prop.put("publicTopmenu", sb.getConfigBool("publicTopmenu", false) ? 1 : 0);
prop.put("search.options", sb.getConfigBool("search.options", false) ? 1 : 0);
prop.put("search.text", sb.getConfigBool("search.text", false) ? 1 : 0);
prop.put("search.image", sb.getConfigBool("search.image", false) ? 1 : 0);
prop.put("search.audio", sb.getConfigBool("search.audio", false) ? 1 : 0);
prop.put("search.video", sb.getConfigBool("search.video", false) ? 1 : 0);
prop.put("search.app", sb.getConfigBool("search.app", false) ? 1 : 0);
prop.put("search.result.show.date", sb.getConfigBool("search.result.show.date", false) ? 1 : 0);
prop.put("search.result.show.size", sb.getConfigBool("search.result.show.size", false) ? 1 : 0);
prop.put("search.result.show.metadata", sb.getConfigBool("search.result.show.metadata", false) ? 1 : 0);
prop.put("search.result.show.parser", sb.getConfigBool("search.result.show.parser", false) ? 1 : 0);
prop.put("search.result.show.pictures", sb.getConfigBool("search.result.show.pictures", false) ? 1 : 0);
prop.put("search.result.show.cache", sb.getConfigBool("search.result.show.cache", false) ? 1 : 0);
prop.put("search.result.show.proxy", sb.getConfigBool("search.result.show.proxy", false) ? 1 : 0);
prop.put("search.result.show.hostbrowser", sb.getConfigBool("search.result.show.hostbrowser", false) ? 1 : 0);
prop.put("search.result.show.tags", sb.getConfigBool("search.result.show.tags", false) ? 1 : 0);
prop.put("search.navigation.filetype", sb.getConfig("search.navigation", "").indexOf("filetype",0) >= 0 ? 1 : 0);
prop.put("search.navigation.protocol", sb.getConfig("search.navigation", "").indexOf("protocol",0) >= 0 ? 1 : 0);
prop.put("search.navigation.hosts", sb.getConfig("search.navigation", "").indexOf("hosts",0) >= 0 ? 1 : 0);
prop.put("search.navigation.authors", sb.getConfig("search.navigation", "").indexOf("authors",0) >= 0 ? 1 : 0);
prop.put("search.navigation.namespace", sb.getConfig("search.navigation", "").indexOf("namespace",0) >= 0 ? 1 : 0);
prop.put("search.navigation.topics", sb.getConfig("search.navigation", "").indexOf("topics",0) >= 0 ? 1 : 0);
prop.put("about.headline", sb.getConfig("about.headline", "About"));
prop.put("about.body", sb.getConfig("about.body", ""));
prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(new Date(System.currentTimeMillis())));
return prop;
}
}

@ -2,6 +2,7 @@
<h3>Integrated Search Configuration</h3>
<ul class="SubMenu">
<li><a href="/ConfigPortal.html" class="MenuItemLink">Generic Search Portal</a></li>
<li><a href="/ConfigSearchPage_p.html" class="MenuItemLink">Search Page Layout</a></li>
<li><a href="/ConfigAppearance_p.html" class="MenuItemLink lock">Appearance</a></li>
<li><a href="/ConfigLanguage_p.html" class="MenuItemLink lock">Language</a></li>
<li><a href="/ConfigProfile_p.html" class="MenuItemLink lock">User Profile</a></li>

@ -364,7 +364,7 @@ public final class search {
// prepare reference hints
final long timer = System.currentTimeMillis();
final ScoreMap<String> topicNavigator = theSearch.rankingProcess.getTopicNavigator(5);
final ScoreMap<String> topicNavigator = theSearch.rankingProcess.getTopics(5);
final StringBuilder refstr = new StringBuilder(6000);
final Iterator<String> navigatorIterator = topicNavigator.keys(false);
int i = 0;

@ -186,7 +186,7 @@ public class yacysearchtrailer {
}
// topics navigator
final ScoreMap<String> topicNavigator = theSearch.rankingProcess.getTopicNavigator(MAX_TOPWORDS);
final ScoreMap<String> topicNavigator = theSearch.getTopicNavigator(MAX_TOPWORDS);
if (topicNavigator == null || topicNavigator.isEmpty()) {
prop.put("nav-topics", "0");
} else {

@ -361,7 +361,7 @@ public final class RankingProcess extends Thread {
return this.localSearchInclusion;
}
public ScoreMap<String> getTopicNavigator(final int count) {
public ScoreMap<String> getTopics(final int count) {
// create a list of words that had been computed by statistics over all
// words that appeared in the url or the description of all urls
final ScoreMap<String> result = new ConcurrentScoreMap<String>();

@ -95,6 +95,7 @@ public final class SearchEvent {
private static final long maxWaitPerResult = 30;
public static final int SNIPPET_MAX_LENGTH = 220;
private final static int SNIPPET_WORKER_THREADS = Math.max(4, Runtime.getRuntime().availableProcessors() * 2);
private static final int MAX_TOPWORDS = 12; // default count of words for topicnavigagtor
private long eventTime;
public QueryParams query;
@ -118,6 +119,7 @@ public final class SearchEvent {
public final ScoreMap<String> protocolNavigator; // a counter for protocol types
public final ScoreMap<String> filetypeNavigator; // a counter for file types
public final Map<String, ScoreMap<String>> vocabularyNavigator; // counters for Vocabularies; key is metatag.getVocabularyName()
private final int topicNavigatorCount; // if 0 no topicNavigator, holds expected number of terms for the topicNavigator
protected final WeakPriorityBlockingQueue<URIMetadataNode> nodeStack;
protected final WeakPriorityBlockingQueue<ResultEntry> result;
protected final LoaderDispatcher loader;
@ -164,9 +166,26 @@ public final class SearchEvent {
} else {
this.namespaceNavigator = null;
}
if (navcfg.contains("hosts")) {
this.hostNavigator = new ConcurrentScoreMap<String>();
} else {
this.hostNavigator = null;
}
if (navcfg.contains("protocol")) {
this.protocolNavigator = new ConcurrentScoreMap<String>();
} else {
this.protocolNavigator = null;
}
if (navcfg.contains("filetype")) {
this.filetypeNavigator = new ConcurrentScoreMap<String>();
} else {
this.filetypeNavigator = null;
}
if (navcfg.contains("topics")) {
topicNavigatorCount = MAX_TOPWORDS;
} else
topicNavigatorCount = 0;
this.vocabularyNavigator = new ConcurrentHashMap<String, ScoreMap<String>>();
this.snippets = new ConcurrentHashMap<String, String>();
@ -478,8 +497,11 @@ public final class SearchEvent {
timer = System.currentTimeMillis();
// collect navigation information
ReversibleScoreMap<String> fcts = facets.get(YaCySchema.host_s.getSolrFieldName());
ReversibleScoreMap<String> fcts;
if (this.hostNavigator != null) {
fcts = facets.get(YaCySchema.host_s.getSolrFieldName());
if (fcts != null) this.hostNavigator.inc(fcts);
}
if (this.filetypeNavigator != null) {
fcts = facets.get(YaCySchema.url_file_ext_s.getSolrFieldName());
@ -514,8 +536,6 @@ public final class SearchEvent {
this.protocolNavigator.inc(fcts);
}
}
//fcts = facets.get(YaCySchema.author.getSolrFieldName());
//if (fcts != null) this.authorNavigator.inc(fcts);
// get the vocabulary navigation
for (Tagging v: LibraryProvider.autotagging.getVocabularies()) {
@ -867,6 +887,18 @@ public final class SearchEvent {
public long getSnippetComputationTime() {
return this.snippetComputationAllTime;
}
/**
* get topic navigator terms from rankig process
* @param count number of requestd words
* 0 = get default number of words otherwise get
* @return
*/
public ScoreMap<String> getTopicNavigator(final int count ) {
if (this.topicNavigatorCount > 0 && count >= 0) { //topicNavigatorCount set during init, 0=no nav
return this.rankingProcess.getTopics(count != 0 ? count : this.topicNavigatorCount);
}
return null;
}
public ResultEntry oneResult(final int item, final long timeout) {
// if there is not yet a worker alive, start one

Loading…
Cancel
Save