adjusted ConfigHeuristic and changed QueryGoal.getOriginalQueryString to .getQueryString

- since specific heuristic Twitter & Blekko is not longer available or redundant with OpenSearchHeuristic,
adjusted ConfigHeuristic to use OpensearchHeuristic settings only.
For this the default OSD search target list is made available (copied) by default and the other configs are removed.

- the return of QueryGoal.getOriginalQueryString includes the queryModifier, which are held separately in a modifier object,
but in most (all) cases just the query term is expected, clarified and renamed it to QueryGoal.getQueryString which returns
just the search term (if needed a .getOrigianlQueryString could be implemented in Queryparameters, adding the modifiers)

- started to adjust internal html href references from absolute to relative (currently it is mixed).
For future development we should prefer relative href targets (less trouble with context aware  servlets)
pull/1/head
reger 11 years ago
parent d24a0ec32c
commit 97e84439fb

@ -1060,8 +1060,6 @@ donation.iframetarget=env/donate.html
# search heuristics
heuristic.site = false
heuristic.blekko = false
heuristic.twitter = false
heuristic.searchresults = false
heuristic.searchresults.crawlglobal = false
heuristic.opensearch = false

@ -170,7 +170,7 @@ public class AccessTracker_p {
if (page == 2) {
// local search
prop.putNum("page_list_" + m + "_offset", query.offset);
prop.putHTML("page_list_" + m + "_querystring", query.getQueryGoal().getOriginalQueryString(false));
prop.putHTML("page_list_" + m + "_querystring", query.getQueryGoal().getQueryString(false));
} else {
// remote search
prop.putHTML("page_list_" + m + "_peername", (query.remotepeer == null) ? "<unknown>" : query.remotepeer.getName());

@ -14,16 +14,16 @@
</p>
<form action=""><fieldset>
The success of heuristics are marked with an image (<img width="16" height="9" src="/env/grafics/heuristic_redundant.gif" title="heuristic:&lt;name&gt; (redundant)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (redundant)"/>/<img width="16" height="9" src="/env/grafics/heuristic_new.gif" title="heuristic:&lt;name&gt; (new link)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (new link)"/>) below the favicon left from the search result entry:
The success of heuristics are marked with an image (<img width="16" height="9" src="env/grafics/heuristic_redundant.gif" title="heuristic:&lt;name&gt; (redundant)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (redundant)"/>/<img width="16" height="9" src="env/grafics/heuristic_new.gif" title="heuristic:&lt;name&gt; (new link)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (new link)"/>) below the favicon left from the search result entry:
<dl>
<dt>
<img width="16" height="9" src="/env/grafics/heuristic_redundant.gif" title="heuristic:&lt;name&gt; (redundant)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (redundant)"/>
<img width="16" height="9" src="env/grafics/heuristic_redundant.gif" title="heuristic:&lt;name&gt; (redundant)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (redundant)"/>
</dt>
<dd>
The search result was discovered by a heuristic, but the link was already known by YaCy
</dd>
<dt>
<img width="16" height="9" src="/env/grafics/heuristic_new.gif" title="heuristic:&lt;name&gt; (new link)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (new link)"/>
<img width="16" height="9" src="env/grafics/heuristic_new.gif" title="heuristic:&lt;name&gt; (new link)" style="width:16px; height:9px;" alt="heuristic:&lt;name&gt; (new link)"/>
</dt>
<dd>
The search result was discovered by a heuristic, not previously known by YaCy
@ -70,33 +70,7 @@
</p>
</fieldset>
</form>
<form id="HeuristicFormTwitter" method="post" action="ConfigHeuristics_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
<input type="checkbox" name="twitter_check" id="twitter" onclick="window.location.href='ConfigHeuristics_p.html?#(twitter.checked)#twitter_on=::twitter_off=#(/twitter.checked)#'" value="twitter"#(twitter.checked)#:: checked="checked"#(/twitter.checked)# />
<label for="twitter">twitter: load external search result list from <a href="http://search.twitter.com" target="_blank">twitter</a></label>
</legend>
<p>
When using this heuristic, then every search request line is used for a call to twitter.
50 results are taken from twitter and loaded simultanously, parsed and indexed immediately.
</p>
</fieldset>
</form>
<form id="HeuristicFormBlekko" method="post" action="ConfigHeuristics_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
<input type="checkbox" name="blekko_check" id="blekko" onclick="window.location.href='ConfigHeuristics_p.html?#(blekko.checked)#blekko_on=::blekko_off=#(/blekko.checked)#'" value="blekko"#(blekko.checked)#:: checked="checked"#(/blekko.checked)# />
<label for="blekko">blekko: load external search result list from <a href="http://blekko.com" target="_blank">blekko</a></label>
</legend>
<p>
When using this heuristic, then every search request line is used for a call to blekko.
20 results are taken from blekko and loaded simultanously, parsed and indexed immediately.
</p>
</fieldset>
</form>
<fieldset>
<form id="HeuristicFormOpenSearch" method="post" action="ConfigHeuristics_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<legend>
@ -137,10 +111,13 @@
<td><input type="text" name="ossys_newurl" size="70"/></td>
<td><input type="submit" name="addnewosd" value="add"/></td>
</tr>
<tr>
<td colspan="3" style="padding-top:10px "><input type="submit" name="setopensearch" value="Save" class="submitready"/></td>
<td colspan="2" align="center" style="padding-top:10px "><input type="submit" name="resettodefaultosdlist" value="reset to default list" class="submitready"/></td>
</tr>
</table>
</div>
<div>
<input type="submit" name="setopensearch" value="Save" class="submitready"/>
<span style="color:red">#[osderrmsg]#</span>
</div>
<br>

@ -61,10 +61,6 @@ public class ConfigHeuristics_p {
if (post.containsKey("searchresult_off")) sb.setConfig(SwitchboardConstants.HEURISTIC_SEARCHRESULTS, false);
if (post.containsKey("searchresultglobal_on")) sb.setConfig(SwitchboardConstants.HEURISTIC_SEARCHRESULTS_CRAWLGLOBAL, true);
if (post.containsKey("searchresultglobal_off")) sb.setConfig(SwitchboardConstants.HEURISTIC_SEARCHRESULTS_CRAWLGLOBAL, false);
if (post.containsKey("blekko_on")) sb.setConfig(SwitchboardConstants.HEURISTIC_BLEKKO, true);
if (post.containsKey("blekko_off")) sb.setConfig(SwitchboardConstants.HEURISTIC_BLEKKO, false);
if (post.containsKey("twitter_on")) sb.setConfig(SwitchboardConstants.HEURISTIC_TWITTER, true);
if (post.containsKey("twitter_off")) sb.setConfig(SwitchboardConstants.HEURISTIC_TWITTER, false);
if (post.containsKey("opensearch_on")) {
sb.setConfig(SwitchboardConstants.HEURISTIC_OPENSEARCH, true);
// re-read config (and create work table)
@ -137,11 +133,11 @@ public class ConfigHeuristics_p {
}
// copy default opensearch heuristic config with sample entries
if (post.containsKey("copydefaultosdconfig")) {
if (post.containsKey("copydefaultosdconfig") || post.containsKey("resettodefaultosdlist")) {
// prepare a solr index profile switch list
final File osdDefaultConfig = new File(sb.getDataPath(), "defaults/heuristicopensearch.conf");
final File osdConfig = new File(sb.getDataPath(), "DATA/SETTINGS/heuristicopensearch.conf");
if (!osdConfig.exists() && osdDefaultConfig.exists()) {
if ((post.containsKey("resettodefaultosdlist") || !osdConfig.exists()) && osdDefaultConfig.exists()) {
try {
Files.copy(osdDefaultConfig, osdConfig);
} catch (final IOException ex) {
@ -158,8 +154,6 @@ public class ConfigHeuristics_p {
prop.put("site.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_SITE, false) ? 1 : 0);
prop.put("searchresult.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_SEARCHRESULTS, false) ? 1 : 0);
prop.put("searchresultglobal.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_SEARCHRESULTS_CRAWLGLOBAL, false) ? 1 : 0);
prop.put("blekko.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_BLEKKO, false) ? 1 : 0);
prop.put("twitter.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_TWITTER, false) ? 1 : 0);
prop.put("opensearch.checked", sb.getConfigBool(SwitchboardConstants.HEURISTIC_OPENSEARCH, false) ? 1 : 0);
// display config file content

@ -93,8 +93,7 @@ public class ConfigNetwork_p
if ( !indexReceive ) {
// remove heuristics
sb.setConfig(SwitchboardConstants.HEURISTIC_SITE, false);
sb.setConfig(SwitchboardConstants.HEURISTIC_BLEKKO, false);
sb.setConfig(SwitchboardConstants.HEURISTIC_TWITTER, false);
sb.setConfig(SwitchboardConstants.HEURISTIC_OPENSEARCH, false);
}
final boolean robinsonmode = "robinson".equals(post.get("network", ""));
if ( robinsonmode ) {

@ -67,7 +67,7 @@ public final class timeline {
language = (agent == null) ? "en" : ISO639.userAgentLanguageDetection(agent);
if (language == null) language = "en";
}
final QueryGoal qg = new QueryGoal(querystring, querystring);
final QueryGoal qg = new QueryGoal(querystring);
HandleSet q = qg.getIncludeHashes();
// tell all threads to do nothing for a specific time

@ -6,14 +6,14 @@
#%env/templates/metas.template%#
<link rel="alternate" type="application/rss+xml" title="Search for #[former]#" href="yacysearch.rss?query=#[former]#" />
<link rel="search" type="application/opensearchdescription+xml" title="YaCy Search on '#[clientname]#'" href="opensearchdescription.xml" />
<link rel="stylesheet" type="text/css" media="screen" href="/env/highslide.css" />
<script type="text/javascript" src="/js/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="env/highslide.css" />
<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>
<link media="screen" type="text/css" href="/yacy/ui/css/autocomplete.css" rel="stylesheet" />
<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>
<link media="screen" type="text/css" href="yacy/ui/css/autocomplete.css" rel="stylesheet" />
<script type="text/javascript" src="js/html.js"></script>
<script type="text/javascript" src="/yacy/ui/js/jquery.autocomplete.yacy.js"></script>
<script type="text/javascript" src="yacy/ui/js/jquery.autocomplete.yacy.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#search').autocomplete('/suggest.json', {parse: opensearch, delay: 0, selectFirst: false, scroll: false, max: 30});
@ -63,7 +63,7 @@
#(searchaudio)#::<input type="radio" id="audio" name="contentdom" value="audio" #(check)#::checked="checked"#(/check)# /><label for="audio">Audio</label>&nbsp;&nbsp;#(/searchaudio)#
#(searchvideo)#::<input type="radio" id="video" name="contentdom" value="video" #(check)#::checked="checked"#(/check)# /><label for="video">Video</label>&nbsp;&nbsp;#(/searchvideo)#
#(searchapp)#::<input type="radio" id="app" name="contentdom" value="app" #(check)#::checked="checked"#(/check)# /><label for="app">Applications</label>#(/searchapp)#
#(searchoptions)#&nbsp;&nbsp;<a href="/index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&amp;former='+document.getElementById('searchform').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a>::#(/searchoptions)#
#(searchoptions)#&nbsp;&nbsp;<a href="index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&amp;former='+document.getElementById('searchform').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a>::#(/searchoptions)#
</div>
#(/searchdomswitches)#
<input type="hidden" name="nav" value="#[search.navigation]#" />
@ -145,11 +145,11 @@
<dt>/http</dt>
<dd>only resources from http or https servers</dd>
<dt>/ftp</dt>
<dd>only resources from ftp servers (they are rare, <a href="/CrawlStartSite_p.html">crawl them yourself</a>)</dd>
<dd>only resources from ftp servers (they are rare, <a href="CrawlStartSite_p.html">crawl them yourself</a>)</dd>
<dt>/smb</dt>
<dd>only resources from smb servers (<a href="/ConfigBasic.html">Intranet Indexing</a> must be selected)</dd>
<dd>only resources from smb servers (<a href="ConfigBasic.html">Intranet Indexing</a> must be selected)</dd>
<dt>/file</dt>
<dd>only files from a local file system (<a href="/ConfigBasic.html">Intranet Indexing</a> must be selected)</dd>
<dd>only files from a local file system (<a href="ConfigBasic.html">Intranet Indexing</a> must be selected)</dd>
</dl>
</dd>
<dt style="width:100px">ranking modifier</dt>
@ -165,6 +165,7 @@
<dd>prefer given language (an ISO639 2-letter code)</dd>
</dl>
</dd>
#(heuristic)#::
<dt style="width:100px">heuristics</dt>
<dd>
<dl style="width:500px">
@ -172,6 +173,7 @@
<dd>add search results from blekko</dd>
</dl>
</dd>
#(/heuristic)#
</dl>
<h4>Search Navigation</h4>

@ -63,7 +63,11 @@ public class index {
final boolean focus = (post == null) ? true : post.get("focus", "1").equals("1");
int searchoptions = (post == null) ? 0 : Math.min(1, post.getInt("searchoptions", 0));
if (!sb.getConfigBool("search.options", true)) searchoptions = 0;
if (!sb.getConfigBool("search.options", true)) {
searchoptions = 0;
} else { // show heuristic hint on search option screen
prop.put("searchoptions_heuristic", sb.getConfigBool(SwitchboardConstants.HEURISTIC_OPENSEARCH, false));
}
final String former = (post == null) ? "" : post.get("former", "");
final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));
final int maximumRecords = sb.getConfigInt(SwitchboardConstants.SEARCH_ITEMS, 10);

@ -485,12 +485,6 @@ public class yacysearch {
modifier.add("/heuristic/blekko");
}
final int heuristicTwitter = querystring.indexOf("/heuristic/twitter", 0);
if ( heuristicTwitter >= 0 ) {
querystring = querystring.replace("/heuristic/twitter", "");
modifier.add("/heuristic/twitter");
}
final int tldp = querystring.indexOf("tld:", 0);
if (tldp >= 0) {
int ftb = querystring.indexOf(' ', tldp);
@ -524,7 +518,7 @@ public class yacysearch {
}
// the query
final QueryGoal qg = new QueryGoal(originalquerystring, querystring.trim());
final QueryGoal qg = new QueryGoal(querystring.trim());
final int maxDistance = (querystring.indexOf('"', 0) >= 0) ? qg.getIncludeHashes().size() - 1 : Integer.MAX_VALUE;
// filter out stopwords
@ -688,7 +682,7 @@ public class yacysearch {
ConcurrentLog.info(
"LOCAL_SEARCH",
"INIT WORD SEARCH: "
+ theQuery.getQueryGoal().getOriginalQueryString(false)
+ theQuery.getQueryGoal().getQueryString(false)
+ ":"
+ QueryParams.hashSet2hashString(theQuery.getQueryGoal().getIncludeHashes())
+ " - "
@ -697,7 +691,7 @@ public class yacysearch {
+ theQuery.itemsPerPage()
+ " lines to be displayed");
EventChannel.channels(EventChannel.LOCALSEARCH).addMessage(
new RSSMessage("Local Search Request", theQuery.getQueryGoal().getOriginalQueryString(false), ""));
new RSSMessage("Local Search Request", theQuery.getQueryGoal().getQueryString(false), ""));
final long timestamp = System.currentTimeMillis();
// create a new search event
@ -724,12 +718,9 @@ public class yacysearch {
if ( modifier.sitehost != null && sb.getConfigBool(SwitchboardConstants.HEURISTIC_SITE, false) && authenticated && !stealthmode) {
sb.heuristicSite(theSearch, modifier.sitehost);
}
if ( (heuristicBlekko >= 0 || sb.getConfigBool(SwitchboardConstants.HEURISTIC_BLEKKO, false)) && authenticated && !stealthmode ) {
if ( heuristicBlekko >= 0 && authenticated && !stealthmode ) {
sb.heuristicRSS("http://blekko.com/ws/$+/rss", theSearch, "blekko");
}
if ( (heuristicTwitter >= 0 || sb.getConfigBool(SwitchboardConstants.HEURISTIC_TWITTER, false)) && authenticated && !stealthmode ) {
sb.heuristicRSS("http://search.twitter.com/search.rss?rpp=50&q=$", theSearch, "twitter");
}
if (sb.getConfigBool(SwitchboardConstants.HEURISTIC_OPENSEARCH, false) && authenticated && !stealthmode) {
OpenSearchConnector.query(sb, theSearch);
}
@ -737,7 +728,7 @@ public class yacysearch {
// log
ConcurrentLog.info("LOCAL_SEARCH", "EXIT WORD SEARCH: "
+ theQuery.getQueryGoal().getOriginalQueryString(false)
+ theQuery.getQueryGoal().getQueryString(false)
+ " - "
+ "local_rwi_available(" + theSearch.local_rwi_available.get() + "), "
+ "local_rwi_stored(" + theSearch.local_rwi_stored.get() + "), "

@ -129,7 +129,7 @@ public class yacysearchitem {
faviconURL = null;
}
final String resource = theSearch.query.domType.toString();
final String origQ = theSearch.query.getQueryGoal().getOriginalQueryString(true);
final String origQ = theSearch.query.getQueryGoal().getQueryString(true);
prop.put("content", 1); // switch on specific content
prop.put("content_showDate", sb.getConfigBool("search.result.show.date", true) ? 1 : 0);
prop.put("content_showSize", sb.getConfigBool("search.result.show.size", true) ? 1 : 0);

@ -85,7 +85,7 @@ public class yacysearchtrailer {
break;
}
nav = "inurl%3A" + name;
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
pos++;
@ -130,7 +130,7 @@ public class yacysearchtrailer {
break;
}
nav = "site%3A" + name;
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
pos++;
@ -174,7 +174,7 @@ public class yacysearchtrailer {
break;
}
nav = (name.indexOf(' ', 0) < 0) ? "author%3A" + name : "author%3A%28" + name.replace(" ", "+") + "%29";
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
pos++;
@ -211,7 +211,7 @@ public class yacysearchtrailer {
prop.put("nav-topics", "1");
navigatorIterator = topicNavigator.keys(false);
int i = 0;
String queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
// first sort the list to a form where the greatest element is in the middle
LinkedList<Map.Entry<String, Integer>> cloud = new LinkedList<Map.Entry<String, Integer>>();
while (i < MAX_TOPWORDS && navigatorIterator.hasNext()) {
@ -257,7 +257,7 @@ public class yacysearchtrailer {
}
visible = visible || "ftp,smb".indexOf(name) >= 0;
nav = "%2F" + name;
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
pos++;
@ -303,7 +303,7 @@ public class yacysearchtrailer {
}
visible = visible || Classification.isMediaExtension(name) || "pdf,doc,docx".indexOf(name) >= 0;
nav = "filetype%3A" + name;
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
pos++;
@ -352,7 +352,7 @@ public class yacysearchtrailer {
break;
}
nav = "%2Fvocabulary%2F" + navname + "%2F" + MultiProtocolURL.escape(Tagging.encodePrintname(name)).toString();
queryStringForUrl = theSearch.query.getQueryGoal().getOriginalQueryString(true);
queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
p = queryStringForUrl.indexOf(nav);
if (p < 0) {
queryStringForUrl += "+" + nav;
@ -397,9 +397,9 @@ public class yacysearchtrailer {
prop.put("cat-location", 0);
} else {
prop.put("cat-location", 1);
final String query = theSearch.query.getQueryGoal().getOriginalQueryString(false);
final String query = theSearch.query.getQueryGoal().getQueryString(false);
prop.put(fileType, "cat-location_query", query);
final String queryenc = theSearch.query.getQueryGoal().getOriginalQueryString(true).replace(' ', '+');
final String queryenc = theSearch.query.getQueryGoal().getQueryString(true).replace(' ', '+');
prop.put(fileType, "cat-location_queryenc", queryenc);
}
prop.put("num-results_totalcount", theSearch.getResultCount());

@ -128,7 +128,7 @@ public class GSAsearchServlet extends HttpServlet {
post.put("originalQuery", originalQuery);
// get a solr query string
QueryGoal qg = new QueryGoal(originalQuery, originalQuery);
QueryGoal qg = new QueryGoal(originalQuery);
StringBuilder solrQ = qg.collectionTextQueryString(sb.index.fulltext().getDefaultConfiguration(), 0, false);
post.put("defType", "edismax");
post.put(CommonParams.Q, solrQ.toString());

@ -135,7 +135,7 @@ public class SolrServlet extends HttpServlet {
QueryModifier modifier = new QueryModifier();
querystring = modifier.parse(querystring);
modifier.apply(mmsp);
QueryGoal qg = new QueryGoal(querystring, querystring);
QueryGoal qg = new QueryGoal(querystring);
StringBuilder solrQ = qg.collectionTextQueryString(sb.index.fulltext().getDefaultConfiguration(), profileNr, false);
mmsp.getMap().put(CommonParams.Q, new String[]{solrQ.toString()}); // sru patch
}

@ -1010,7 +1010,7 @@ public final class Protocol {
final int partitions,
final Blacklist blacklist) {
if (event.query.getQueryGoal().getOriginalQueryString(false) == null || event.query.getQueryGoal().getOriginalQueryString(false).length() == 0) {
if (event.query.getQueryGoal().getQueryString(false) == null || event.query.getQueryGoal().getQueryString(false).length() == 0) {
return -1; // we cannot query solr only with word hashes, there is no clear text string
}
event.addExpectedRemoteReferences(count);

@ -682,6 +682,16 @@ public final class Switchboard extends serverSwitch {
this.log.info("surrogates.out Path = " + this.surrogatesOutPath.getAbsolutePath());
this.surrogatesOutPath.mkdirs();
// copy opensearch heuristic config (if not exist)
final File osdConfig = new File(getDataPath(), "DATA/SETTINGS/heuristicopensearch.conf");
if (!osdConfig.exists()) {
final File osdDefaultConfig = new File("defaults/heuristicopensearch.conf");
this.log.info("heuristic.opensearch list Path = " + osdDefaultConfig.getAbsolutePath());
try {
Files.copy(osdDefaultConfig, osdConfig);
} catch (final IOException ex) { }
}
// create the release download directory
this.releasePath =
getDataPath(SwitchboardConstants.RELEASE_PATH, SwitchboardConstants.RELEASE_PATH_DEFAULT);
@ -1321,8 +1331,7 @@ public final class Switchboard extends serverSwitch {
// remove heuristics
setConfig(SwitchboardConstants.HEURISTIC_SITE, false);
setConfig(SwitchboardConstants.HEURISTIC_BLEKKO, false);
setConfig(SwitchboardConstants.HEURISTIC_TWITTER, false);
setConfig(SwitchboardConstants.HEURISTIC_OPENSEARCH, false);
// relocate
this.peers.relocate(
@ -3582,7 +3591,7 @@ public final class Switchboard extends serverSwitch {
new Thread() {
@Override
public void run() {
String queryString = searchEvent.query.getQueryGoal().getOriginalQueryString(false);
String queryString = searchEvent.query.getQueryGoal().getQueryString(false);
Thread.currentThread().setName("Switchboard.heuristicRSS:" + queryString);
final int meta = queryString.indexOf("heuristic:", 0);
if ( meta >= 0 ) {

@ -522,8 +522,6 @@ public final class SwitchboardConstants {
public static final String HEURISTIC_SITE = "heuristic.site";
public static final String HEURISTIC_SEARCHRESULTS = "heuristic.searchresults";
public static final String HEURISTIC_SEARCHRESULTS_CRAWLGLOBAL = "heuristic.searchresults.crawlglobal";
public static final String HEURISTIC_BLEKKO = "heuristic.blekko";
public static final String HEURISTIC_TWITTER = "heuristic.twitter";
public static final String HEURISTIC_OPENSEARCH = "heuristic.opensearch";
/*

@ -96,7 +96,7 @@ public class AccessTracker {
private static void add(final LinkedList<QueryParams> list, final QueryParams query, int resultCount) {
// learn that this word can be a word completion for the DidYouMeanLibrary
String queryString = query.getQueryGoal().getOriginalQueryString(false);
String queryString = query.getQueryGoal().getQueryString(false);
if (resultCount > 10 && queryString != null && queryString.length() > 0) {
final StringBuilder sb = new StringBuilder(queryString);
sb.append(queryString);
@ -138,7 +138,7 @@ public class AccessTracker {
}
private static void addToDump(final QueryParams query, int resultCount) {
String queryString = query.getQueryGoal().getOriginalQueryString(false);
String queryString = query.getQueryGoal().getQueryString(false);
if (queryString == null || queryString.isEmpty()) return;
addToDump(queryString, Integer.toString(resultCount), new Date(query.starttime));
}

@ -97,11 +97,14 @@ public class QueryGoal {
this.include_hashes = include_hashes;
this.exclude_hashes = exclude_hashes;
}
public QueryGoal(String query_original, String query_words) {
assert query_original != null;
/**
* Creates a QueryGoal from a serach query string
* @param query_words search string (the actual search terms, excluding application specific modifier)
*/
public QueryGoal(String query_words) {
assert query_words != null;
this.query_original = query_original;
this.query_original = query_words;
this.include_words = new NormalizedWords();
this.exclude_words = new NormalizedWords();
this.include_strings = new ArrayList<String>();
@ -175,7 +178,14 @@ public class QueryGoal {
}
}
public String getOriginalQueryString(final boolean encodeHTML) {
/**
* Search query string (without YaCy specific modifier like site:xxx or /smb)
* the modifier are held separately in a search paramter modifier
*
* @param encodeHTML
* @return
*/
public String getQueryString(final boolean encodeHTML) {
if (this.query_original == null) return null;
String ret;
if (encodeHTML){
@ -189,7 +199,7 @@ public class QueryGoal {
}
return ret;
}
/**
* @return a set of hashes of words to be included in the search result.
* if possible, use getIncludeWords instead

@ -602,7 +602,7 @@ public final class QueryParams {
sb.append("/yacysearch.");
sb.append(ext);
sb.append("?query=");
sb.append(newQueryString == null ? theQuery.getQueryGoal().getOriginalQueryString(true) : newQueryString);
sb.append(newQueryString == null ? theQuery.getQueryGoal().getQueryString(true) : newQueryString);
sb.append("&maximumRecords=");
sb.append(theQuery.itemsPerPage());
@ -625,7 +625,7 @@ public final class QueryParams {
sb.append(theQuery.contentdom.toString());
sb.append("&former=");
sb.append(theQuery.getQueryGoal().getOriginalQueryString(true));
sb.append(theQuery.getQueryGoal().getQueryString(true));
return sb;
}

@ -454,7 +454,7 @@ public final class SearchEvent {
new ProfilingGraph.EventSearch(
SearchEvent.this.query.id(true),
SearchEventType.JOIN,
SearchEvent.this.query.getQueryGoal().getOriginalQueryString(false),
SearchEvent.this.query.getQueryGoal().getQueryString(false),
index.size(),
System.currentTimeMillis() - timer),
false);

Loading…
Cancel
Save