From 8a4ea1c11ec8cb1b49ea5ec55195c5ad2d9f9d47 Mon Sep 17 00:00:00 2001 From: luccioman Date: Tue, 2 Jan 2018 08:13:14 +0100 Subject: [PATCH] Added UI switch to control content domain constraint per search request --- htroot/ConfigPortal_p.html | 2 +- htroot/index.html | 13 +++++++++++++ htroot/index.java | 3 +++ htroot/yacysearch.html | 1 + htroot/yacysearch.java | 2 ++ htroot/yacysearchtrailer.html | 6 ++++++ htroot/yacysearchtrailer.java | 2 ++ source/net/yacy/search/query/QueryParams.java | 3 +++ 8 files changed, 31 insertions(+), 1 deletion(-) diff --git a/htroot/ConfigPortal_p.html b/htroot/ConfigPortal_p.html index 86c7bb4db..5b6520fe8 100644 --- a/htroot/ConfigPortal_p.html +++ b/htroot/ConfigPortal_p.html @@ -60,7 +60,7 @@ -

Control whether media search results are strictly limited to indexed documents matching exactly the desired content domain (images, videos or applications specific), +

Control whether media search results are as default strictly limited to indexed documents matching exactly the desired content domain (images, videos or applications specific), or extended to pages including such medias (provide generally more results, but eventually less relevant).

diff --git a/htroot/index.html b/htroot/index.html index 0bb8725da..59659a78e 100644 --- a/htroot/index.html +++ b/htroot/index.html @@ -138,6 +138,19 @@ + + : + +
+ + +
+ +

Query Operators

diff --git a/htroot/index.java b/htroot/index.java index 69fec98bf..ce36e34f6 100644 --- a/htroot/index.java +++ b/htroot/index.java @@ -134,6 +134,9 @@ public class index { prop.put("searchoptions_prefermaskoptions", "0"); prop.putHTML("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter); prop.put("searchoptions_indexofChecked", ""); + prop.put("searchoptions_" + SwitchboardConstants.SEARCH_STRICT_CONTENT_DOM, + sb.getConfigBool(SwitchboardConstants.SEARCH_STRICT_CONTENT_DOM, + SwitchboardConstants.SEARCH_STRICT_CONTENT_DOM_DEFAULT) ? 1 : 0); prop.put("results", ""); prop.put("type", type); prop.put("depth", "0"); diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html index 4d8a52ea7..50ef06494 100644 --- a/htroot/yacysearch.html +++ b/htroot/yacysearch.html @@ -113,6 +113,7 @@ Use the RSS search result format to add static searches to your RSS reader, if y #(/authSearch)# + diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java index df72f3fb7..f210394f7 100644 --- a/htroot/yacysearch.java +++ b/htroot/yacysearch.java @@ -190,6 +190,7 @@ public class yacysearch { "search.navigation", (post == null) ? sb.getConfig("search.navigation", "all") : post.get("nav", "all")); prop.put("contentdom", "text"); + prop.put("strictContentDom", "false"); prop.put("contentdomCheckText", "1"); prop.put("contentdomCheckAudio", "0"); prop.put("contentdomCheckVideo", "0"); @@ -965,6 +966,7 @@ public class yacysearch { prop.put("search.verify", snippetFetchStrategy == null ? sb.getConfig("search.verify", "iffresh") : snippetFetchStrategy.toName()); prop.put("search.navigation", (post == null) ? sb.getConfig("search.navigation", "all") : post.get("nav", "all")); prop.putHTML("contentdom", (post == null ? "text" : post.get("contentdom", "text"))); + prop.putHTML("strictContentDom", String.valueOf(strictContentDom)); // for RSS: don't HTML encode some elements prop.putXML("rss_query", originalquerystring); diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html index 4c134e4c4..e35eba893 100644 --- a/htroot/yacysearchtrailer.html +++ b/htroot/yacysearchtrailer.html @@ -66,6 +66,12 @@ #(searchvideo)#::
#(/searchvideo)# #(searchapp)#::
#(/searchapp)# +#(strictContentDomSwitch)#:: +
+
+
+
+#(/strictContentDomSwitch)# #(/searchdomswitches)# #(nav-protocols)#:: diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java index 4fce45d54..d7fc421e8 100644 --- a/htroot/yacysearchtrailer.java +++ b/htroot/yacysearchtrailer.java @@ -121,6 +121,8 @@ public class yacysearchtrailer { prop.put("searchdomswitches_searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0"); prop.put("searchdomswitches_searchimage_check", (contentdom == ContentDomain.IMAGE) ? "1" : "0"); prop.put("searchdomswitches_searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0"); + prop.put("searchdomswitches_strictContentDomSwitch", (contentdom != ContentDomain.TEXT && contentdom != ContentDomain.ALL) ? 1 : 0); + prop.put("searchdomswitches_strictContentDomSwitch_strictContentDom", theSearch.getQuery().isStrictContentDom() ? 1 : 0); String name; int count; diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.java index c757e2bff..332aaaee0 100644 --- a/source/net/yacy/search/query/QueryParams.java +++ b/source/net/yacy/search/query/QueryParams.java @@ -967,6 +967,9 @@ public final class QueryParams { sb.append("&contentdom="); sb.append(theQuery.contentdom.toString()); + + sb.append("&strictContentDom="); + sb.append(String.valueOf(theQuery.isStrictContentDom())); sb.append("&former="); sb.append(theQuery.getQueryGoal().getQueryString(true));