Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Added UI switch to control content domain constraint per search request

luccioman8a4ea1c11ec8
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 @@
<label>
<input type="radio" name="search.strictContentDom" value="true" #(search.strictContentDom)#::checked="checked"#(/search.strictContentDom)# />Strict
</label>
- <p>Control whether media search results are strictly limited to indexed documents matching exactly the desired content domain (images, videos or applications specific),
+ <p>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).
</p>
</dd>
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 @@
<input type="checkbox" id="indexof" name="indexof" #[indexofChecked]# /> <label for="indexof">only index pages</label>
</td>
</tr>
+ <tr>
+ <td><label id="mediaSearchLabel">Media search</label>:</td>
+ <td>
+ <fieldset aria-labelledby="mediaSearchLabel">
+ <label title="Extend media search results (images, videos or applications specific) to pages including such medias (provides generally more results, but eventually less relevant).">
+ <input type="radio" name="strictContentDom" value="false" #(search.strictContentDom)#checked="checked"::#(/search.strictContentDom)#/> Extended
+ </label>
+ <label title="Strictly limit media search results (images, videos or applications specific) to indexed documents matching exactly the desired content domain.">
+ <input type="radio" name="strictContentDom" value="true" #(search.strictContentDom)#::checked="checked"#(/search.strictContentDom)#> Strict
+ </label>
+ </fieldset>
+ </td>
+ </tr>
</table>
<h4>Query Operators</h4>
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
<input type="hidden" name="auth" id="auth" value=""/>
#(/authSearch)#
<input type="hidden" name="contentdom" id="contentdom" value="#[contentdom]#" />
+ <input type="hidden" name="strictContentDom" id="strictContentDom" value="#[strictContentDom]#" />
<input type="hidden" name="former" value="#[former]#" />
<input type="hidden" name="maximumRecords" value="#[count]#" />
<input type="hidden" name="startRecord" id="startRecord" value="0" />
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)#::<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(check)#:: active#(/check)#"#(check)# onclick="document.getElementById('contentdom').value='video';document.searchform.submit();"::#(/check)#>Video</button></div>#(/searchvideo)#
#(searchapp)#::<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(check)#:: active#(/check)#"#(check)# onclick="document.getElementById('contentdom').value='app';document.searchform.submit();"::#(/check)#>Apps</button></div>#(/searchapp)#
</div>
+#(strictContentDomSwitch)#::
+<div class="btn-group btn-group-justified">
+ <div class="btn-group btn-group-xs"><button type="button" title="Extend media search results to pages including such medias (provides generally more results, but eventually less relevant)" class="btn btn-default#(strictContentDom)# active::#(/strictContentDom)#" #(strictContentDom)#::onclick="document.getElementById('strictContentDom').value='false';document.searchform.submit();"#(/strictContentDom)#>Extended</button></div>
+ <div class="btn-group btn-group-xs"><button type="button" title="Strictly limit media search results to indexed documents matching exactly the desired content domain." class="btn btn-default#(strictContentDom)#:: active#(/strictContentDom)#" #(strictContentDom)#onclick="document.getElementById('strictContentDom').value='true';document.searchform.submit();"::#(/strictContentDom)#>Strict</button></div>
+</div>
+#(/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));