Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
adopted DetailedSearch page to new ranking options - fixed bug http://www.yacy-forum.de/viewtopic.php?t=3265 - more attributes on page - attributes can be set as default for main search page - option to re-set the attributes to built-in values
orbiter8e3bd175546c
diff --git a/htroot/DetailedSearch.html b/htroot/DetailedSearch.htmlindex a72e607a3..93e041bc3 100644--- a/htroot/DetailedSearch.html+++ b/htroot/DetailedSearch.html@@ -21,6 +21,12 @@}document.write(n);}+ function checkerline(descr, tag, dflt) {+ document.write("<dt>" + descr + "</dt>");+ document.write("<dd>");+ checkers(tag, dflt);+ document.write("</dd>");+ }/* ]]> */</script><h2>Detailed Search</h2>@@ -45,71 +51,47 @@</dl></fieldset><fieldset>- <legend>Local Pre-Ranking</legend>+ <legend>Pre-Ranking</legend><dl>- <dt>Date</dt>- <dd>- <script type="text/javascript">checkers("localdate", #[localdate]#)</script>- </dd>- <dt>YBR</dt>- <dd>- <script type="text/javascript">checkers("localybr", #[localybr]#)</script>- </dd>- <dt>Position in Text</dt>- <dd>- <script type="text/javascript">checkers("localposintext", #[localposintext]#)</script>- </dd>- <dt>Word Distance</dt>- <dd>- <script type="text/javascript">checkers("localworddistance", #[localworddistance]#)</script>- </dd>- <dt>Word Hit Count</dt>- <dd>- <script type="text/javascript">checkers("localhitcount", #[localhitcount]#)</script>- </dd>- <dt>Domain Length</dt>- <dd>- <script type="text/javascript">checkers("localdomlength", #[localdomlength]#)</script>- </dd>+ <script type="text/javascript">checkerline("Domain Length", "localdomlength", #[localdomlength]#)</script>+ <script type="text/javascript">checkerline("YaCy Block Rank", "localybr", #[localybr]#)</script>+ <script type="text/javascript">checkerline("Date", "localdate", #[localdate]#)</script>+ <script type="text/javascript">checkerline("Words In Title", "localwordsintitle", #[localwordsintitle]#)</script>+ <script type="text/javascript">checkerline("Words In Text", "localwordsintext", #[localwordsintext]#)</script>+ <script type="text/javascript">checkerline("Phrases In Text", "localphrasesintext", #[localphrasesintext]#)</script>+ <script type="text/javascript">checkerline("Links To Local Domain", "localllocal", #[localllocal]#)</script>+ <script type="text/javascript">checkerline("Links To Other Domain", "locallother", #[locallother]#)</script>+ <script type="text/javascript">checkerline("URL Length", "localurllength", #[localurllength]#)</script>+ <script type="text/javascript">checkerline("URL Components", "localurlcomps", #[localurlcomps]#)</script>+ <script type="text/javascript">checkerline("Hit Count", "localhitcount", #[localhitcount]#)</script>+ <script type="text/javascript">checkerline("Position In Text", "localposintext", #[localposintext]#)</script>+ <script type="text/javascript">checkerline("Position Of Phrase", "localposofphrase", #[localposofphrase]#)</script>+ <script type="text/javascript">checkerline("Word Distance", "localworddistance", #[localworddistance]#)</script>+ <script type="text/javascript">checkerline("Appearance in URL", "localappurl", #[localappurl]#)</script>+ <script type="text/javascript">checkerline("Appearance in Description", "localappdescr", #[localappdescr]#)</script>+ <script type="text/javascript">checkerline("Appearance in Author", "localappauthor", #[localappauthor]#)</script>+ <script type="text/javascript">checkerline("Appearance in Tags", "localapptags", #[localapptags]#)</script>+ <script type="text/javascript">checkerline("Appearance in Reference", "localappref", #[localappref]#)</script>+ <script type="text/javascript">checkerline("Appearance in Emphasized Text", "localappemph", #[localappemph]#)</script>+ <script type="text/javascript">checkerline("Category Index Page", "localcatindexof", #[localcatindexof]#)</script>+ <script type="text/javascript">checkerline("Category Image Appearance", "localcathasimage", #[localcathasimage]#)</script>+ <script type="text/javascript">checkerline("Category Audio Appearance", "localcathasaudio", #[localcathasaudio]#)</script>+ <script type="text/javascript">checkerline("Category Video Appearance", "localcathasvideo", #[localcathasvideo]#)</script>+ <script type="text/javascript">checkerline("Category App. Appearance", "localcathasapp", #[localcathasapp]#)</script></dl></fieldset><fieldset>- <legend>Local Post-Ranking</legend>+ <legend>Post-Ranking</legend><dl>- <dt>URL Length</dt>- <dd>- <script type="text/javascript">checkers("localurllength", #[localurllength]#)</script>- </dd>- <dt>URL Components</dt>- <dd>- <script type="text/javascript">checkers("localurlcomps", #[localurlcomps]#)</script>- </dd>- <dt>Description Length</dt>- <dd>- <script type="text/javascript">checkers("localdescrlength", #[localdescrlength]#)</script>- </dd>- <dt>Description Components</dt>- <dd>- <script type="text/javascript">checkers("localdescrcomps", #[localdescrcomps]#)</script>- </dd>- <dt>Query appears in URL</dt>- <dd>- <script type="text/javascript">checkers("localqueryinurl", #[localqueryinurl]#)</script>- </dd>- <dt>Query appears in Description</dt>- <dd>- <script type="text/javascript">checkers("localqueryindescr", #[localqueryindescr]#)</script>- </dd>- <dt>URL Component appears in Toplist</dt>- <dd>- <script type="text/javascript">checkers("localurlcompintoplist", #[localurlcompintoplist]#)</script>- </dd>- <dt>Description Component appears in Toplist</dt>- <dd>- <script type="text/javascript">checkers("localdescrcompintoplist", #[localdescrcompintoplist]#)</script>- </dd>+ <script type="text/javascript">checkerline("URL Component Appears In Toplist", "localurlcompintoplist", #[localurlcompintoplist]#)</script>+ <script type="text/javascript">checkerline("Description Comp. Appears In Toplist", "localdescrcompintoplist", #[localdescrcompintoplist]#)</script>+ <script type="text/javascript">checkerline("Application Of Prefer Pattern", "localprefer", #[localprefer]#)</script></dl></fieldset>+ <fieldset>+ <input type="submit" name="EnterRanking" value="Set as Default Ranking" />+ <input type="submit" name="ResetRanking" value="Re-Set to Built-In Ranking" />+ </fieldset></form>#(type)##(excluded)#@@ -145,6 +127,7 @@#{/results}##(/type)#<!-- linklist end -->+#%env/templates/footer.template%#</body></html>\ No newline at end of filediff --git a/htroot/DetailedSearch.java b/htroot/DetailedSearch.javaindex f80e4e8d1..a74ecbe48 100644--- a/htroot/DetailedSearch.java+++ b/htroot/DetailedSearch.java@@ -59,38 +59,59 @@ import de.anomic.server.serverCore;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyCore;+import de.anomic.tools.crypt;public class DetailedSearch {+ private static serverObjects defaultValues() {+ final serverObjects prop = new serverObjects();+ prop.put("search", "");+ prop.put("num-results", 0);+ prop.put("excluded", 0);+ prop.put("combine", 0);+ prop.put("resultbottomline", 0);+ prop.put("localCount", 10);+ prop.put("localWDist", 999);+ //prop.put("globalChecked", "checked");+ prop.put("globalChecked", "");+ prop.put("postsortChecked", "checked=\"checked\"");+ prop.put("localTime", 6);+ prop.put("results", "");+ prop.put("urlmaskoptions", 0);+ prop.put("urlmaskoptions_urlmaskfilter", ".*");+ return prop;+ }+public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {final plasmaSwitchboard sb = (plasmaSwitchboard) env;// case if no values are requestedif (post == null || env == null) {// we create empty entries for template strings- final serverObjects prop = new serverObjects();- prop.put("promoteSearchPageGreeting", env.getConfig("promoteSearchPageGreeting", ""));- prop.put("search", "");- prop.put("num-results", 0);- prop.put("excluded", 0);- prop.put("combine", 0);- prop.put("resultbottomline", 0);- prop.put("localCount", 10);- prop.put("localWDist", 999);- //prop.put("globalChecked", "checked");- prop.put("globalChecked", "");- prop.put("postsortChecked", "checked=\"checked\"");- prop.put("localTime", 6);- prop.put("results", "");- prop.put("urlmaskoptions", 0);- prop.put("urlmaskoptions_urlmaskfilter", ".*");- String defaultRankingProfile = new plasmaSearchRankingProfile("text").toExternalString();- prop.putAll(new plasmaSearchRankingProfile("", defaultRankingProfile).toExternalMap("local"));+ final serverObjects prop = defaultValues();+ plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile("text") : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));+ prop.putAll(ranking.toExternalMap("local"));return prop;}-- boolean global = (post == null) ? false : post.get("global", "").equals("on");- boolean postsort = (post == null) ? false : post.get("postsort", "").equals("on");++ if (post.containsKey("EnterRanking")) {+ plasmaSearchRankingProfile ranking = new plasmaSearchRankingProfile("local", post.toString());+ sb.setConfig("rankingProfile", crypt.simpleEncode(ranking.toExternalString()));+ final serverObjects prop = defaultValues();+ prop.putAll(ranking.toExternalMap("local"));+ return prop;+ }++ if (post.containsKey("ResetRanking")) {+ sb.setConfig("rankingProfile", "");+ plasmaSearchRankingProfile ranking = new plasmaSearchRankingProfile("text");+ final serverObjects prop = defaultValues();+ prop.putAll(ranking.toExternalMap("local"));+ return prop;+ }++ boolean global = post.get("global", "").equals("on");+ boolean postsort = post.get("postsort", "").equals("on");final boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 40e24e379..685b67ab9 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -71,6 +71,7 @@ import de.anomic.server.serverCore;import de.anomic.server.serverDate;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;+import de.anomic.tools.crypt;import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacyNewsRecord;@@ -253,7 +254,7 @@ public class yacysearch {"",20,constraint);- plasmaSearchRankingProfile ranking = new plasmaSearchRankingProfile(contentdomString);+ plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile(contentdomString) : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));plasmaSearchTimingProfile localTiming = new plasmaSearchTimingProfile(4 * thisSearch.maximumTime / 10, thisSearch.wantedResults);plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults);prop = sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true);diff --git a/source/de/anomic/plasma/plasmaSearchRankingProfile.java b/source/de/anomic/plasma/plasmaSearchRankingProfile.javaindex bb49c9c0d..95119a2a0 100644--- a/source/de/anomic/plasma/plasmaSearchRankingProfile.java+++ b/source/de/anomic/plasma/plasmaSearchRankingProfile.java@@ -82,8 +82,6 @@ public class plasmaSearchRankingProfile {public static final String CATHASAPP = "cathasapp";// post-sort predicates- public static final String QUERYINURL = "queryinurl";- public static final String QUERYINDESCR = "queryindescr";public static final String URLCOMPINTOPLIST = "urlcompintoplist";public static final String DESCRCOMPINTOPLIST = "descrcompintoplist";public static final String PREFER = "prefer";@@ -94,7 +92,7 @@ public class plasmaSearchRankingProfile {coeff_posintext, coeff_posofphrase, coeff_worddistance,coeff_appurl, coeff_appdescr, coeff_appauthor, coeff_apptags, coeff_appref, coeff_appemph,coeff_catindexof, coeff_cathasimage, coeff_cathasaudio, coeff_cathasvideo, coeff_cathasapp,- coeff_queryinurl, coeff_queryindescr, coeff_urlcompintoplist, coeff_descrcompintoplist, coeff_prefer;+ coeff_urlcompintoplist, coeff_descrcompintoplist, coeff_prefer;public plasmaSearchRankingProfile(String mediatype) {// set default-values@@ -119,16 +117,14 @@ public class plasmaSearchRankingProfile {coeff_apptags = 8;coeff_appref = 9;coeff_appemph = 11;- coeff_queryinurl = 12;- coeff_queryindescr = 8;coeff_urlcompintoplist = 3;coeff_descrcompintoplist = 2;coeff_prefer = 15;- coeff_catindexof = (mediatype.equals("text")) ? 0 : 10;- coeff_cathasimage = (mediatype.equals("image")) ? 15 : 0;- coeff_cathasaudio = (mediatype.equals("audio")) ? 15 : 0;- coeff_cathasvideo = (mediatype.equals("video")) ? 15 : 0;- coeff_cathasapp = (mediatype.equals("app")) ? 15 : 0;+ coeff_catindexof = (mediatype.equals("text")) ? 1 : 10;+ coeff_cathasimage = (mediatype.equals("image")) ? 15 : 1;+ coeff_cathasaudio = (mediatype.equals("audio")) ? 15 : 1;+ coeff_cathasvideo = (mediatype.equals("video")) ? 15 : 1;+ coeff_cathasapp = (mediatype.equals("app")) ? 15 : 1;}public plasmaSearchRankingProfile(String prefix, String profile) {@@ -140,10 +136,12 @@ public class plasmaSearchRankingProfile {int p;int s = (prefix == null) ? 0 : prefix.length();String e;+for (int i = 0; i < elts.length; i++) {e = elts[i].trim();if ((s == 0) || (e.startsWith(prefix))) {- coeff.put(e.substring(s, (p = e.indexOf("="))), new Integer(Integer.parseInt(e.substring(p + 1))));+ p = e.indexOf("=");+ if (e.length() > p + 1) coeff.put(e.substring(s, p), new Integer(Integer.parseInt(e.substring(p + 1))));}}coeff_domlength = parseMap(coeff, DOMLENGTH, coeff_domlength);@@ -166,13 +164,11 @@ public class plasmaSearchRankingProfile {coeff_apptags = parseMap(coeff, APPTAGS, coeff_apptags);coeff_appref = parseMap(coeff, APPREF, coeff_appref);coeff_appemph = parseMap(coeff, APPEMPH, coeff_appemph);- coeff_catindexof = parseMap(coeff, APPEMPH, coeff_catindexof);- coeff_cathasimage = parseMap(coeff, APPEMPH, coeff_cathasimage);- coeff_cathasaudio = parseMap(coeff, APPEMPH, coeff_cathasaudio);- coeff_cathasvideo = parseMap(coeff, APPEMPH, coeff_cathasvideo);- coeff_cathasapp = parseMap(coeff, APPEMPH, coeff_cathasapp);- coeff_queryinurl = parseMap(coeff, QUERYINURL, coeff_queryinurl);- coeff_queryindescr = parseMap(coeff, QUERYINDESCR, coeff_queryindescr);+ coeff_catindexof = parseMap(coeff, CATINDEXOF, coeff_catindexof);+ coeff_cathasimage = parseMap(coeff, CATHASIMAGE, coeff_cathasimage);+ coeff_cathasaudio = parseMap(coeff, CATHASAUDIO, coeff_cathasaudio);+ coeff_cathasvideo = parseMap(coeff, CATHASVIDEO, coeff_cathasvideo);+ coeff_cathasapp = parseMap(coeff, CATHASAPP, coeff_cathasapp);coeff_urlcompintoplist = parseMap(coeff, URLCOMPINTOPLIST, coeff_urlcompintoplist);coeff_descrcompintoplist = parseMap(coeff, DESCRCOMPINTOPLIST, coeff_descrcompintoplist);coeff_prefer = parseMap(coeff, PREFER, coeff_prefer);@@ -181,7 +177,7 @@ public class plasmaSearchRankingProfile {private static int parseMap(HashMap coeff, String attr, int dflt) {if (coeff.containsKey(attr)) try {- return Integer.parseInt((String) coeff.get(attr));+ return ((Integer) coeff.get(attr)).intValue();} catch (NumberFormatException e) {return dflt;} else {@@ -220,8 +216,6 @@ public class plasmaSearchRankingProfile {ext.put(prefix + CATHASAUDIO, Integer.toString(coeff_cathasaudio));ext.put(prefix + CATHASVIDEO, Integer.toString(coeff_cathasvideo));ext.put(prefix + CATHASAPP, Integer.toString(coeff_cathasapp));- ext.put(prefix + QUERYINURL, Integer.toString(coeff_queryinurl));- ext.put(prefix + QUERYINDESCR, Integer.toString(coeff_queryindescr));ext.put(prefix + URLCOMPINTOPLIST, Integer.toString(coeff_urlcompintoplist));ext.put(prefix + DESCRCOMPINTOPLIST, Integer.toString(coeff_descrcompintoplist));ext.put(prefix + PREFER, Integer.toString(coeff_prefer));@@ -258,7 +252,7 @@ public class plasmaSearchRankingProfile {ranking += (normalizedEntry.urlcomps() == 0) ? 0 : (256 - normalizedEntry.urlcomps()) << coeff_urlcomps;ranking += (normalizedEntry.hitcount() == 0) ? 0 : normalizedEntry.hitcount() << coeff_hitcount;ranking += (normalizedEntry.posintext() == 0) ? 0 : (256 - normalizedEntry.posintext()) << coeff_posintext;- ranking += (normalizedEntry.posofphrase() == 0) ? 0 : (256 - normalizedEntry.hitcount()) << coeff_posofphrase;+ ranking += (normalizedEntry.posofphrase() == 0) ? 0 : (256 - normalizedEntry.posofphrase()) << coeff_posofphrase;ranking += (normalizedEntry.worddistance() == 0) ? 0 : (256 - normalizedEntry.worddistance()) << coeff_worddistance;kelondroBitfield flags = normalizedEntry.flags();@@ -275,7 +269,7 @@ public class plasmaSearchRankingProfile {ranking += (flags.get(plasmaCondenser.flag_cat_hasapp)) ? 256 << coeff_cathasapp : 0;ranking += (plasmaURL.probablyRootURL(normalizedEntry.urlHash())) ? 16 << coeff_urllength : 0;- ranking += (plasmaURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord) != null) ? 256 << coeff_queryinurl : 0;+ ranking += (plasmaURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord) != null) ? 256 << coeff_appurl : 0;/*if (indexURL.probablyWordURL(normalizedEntry.urlHash(), searchedWord))@@ -320,8 +314,8 @@ public class plasmaSearchRankingProfile {String queryhash;while (shi.hasNext()) {queryhash = (String) shi.next();- if (urlcomph.contains(queryhash)) ranking += 256 << coeff_queryinurl;- if (descrcomph.contains(queryhash)) ranking += 256 << coeff_queryindescr;+ if (urlcomph.contains(queryhash)) ranking += 256 << coeff_appurl;+ if (descrcomph.contains(queryhash)) ranking += 256 << coeff_appdescr;}return ranking;diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 06880ea83..3066ba349 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -464,7 +464,7 @@ public final class yacyClient {}if (result.size() == 0) {- yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + " (zero response), score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes));+ yacyCore.log.logFine("SEARCH failed FROM " + targetPeer.hash + ":" + targetPeer.getName() + " (zero response), score=" + targetPeer.selectscore + ", DHTdist=" + yacyDHTAction.dhtDistance(targetPeer.hash, wordhashes.substring(0, 12)));return null;}diff --git a/yacy.init b/yacy.initindex 6aea2da14..d964ea011 100644--- a/yacy.init+++ b/yacy.init@@ -852,3 +852,10 @@ soap.serviceDeploymentList =# all - everybody has write right# user - the admin and every user registered in the user db has write rightWikiAccess = admin++# Search Profiles+# we will support different search profiles+# this is currently only a single default profile+# If this profile setting is empty, a hard-coded profile from plasmaSearchRanking is used+rankingProfile =+