Permalink
Browse files

Added UI switch to control content domain constraint per search request

  • Loading branch information...
luccioman committed Jan 2, 2018
1 parent 36a45b3 commit 8a4ea1c11ec8cb1b49ea5ec55195c5ad2d9f9d47
@@ -60,7 +60,7 @@ <h2>Integration of a Search Portal</h2>
<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>
@@ -138,6 +138,19 @@ <h2 class="yacy">#[promoteSearchPageGreeting]#</h2>
<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>
@@ -134,6 +134,9 @@ public static serverObjects respond(final RequestHeader header, final serverObje
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");
@@ -113,6 +113,7 @@
<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" />
@@ -190,6 +190,7 @@ public static serverObjects respond(
"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 static serverObjects respond(
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);
@@ -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)#::
@@ -121,6 +121,8 @@ public static serverObjects respond(final RequestHeader header, final serverObje
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;
@@ -967,6 +967,9 @@ public static StringBuilder navurlBase(final RequestHeader.FileType ext, final Q
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));

0 comments on commit 8a4ea1c

Please sign in to comment.