Added UI switch to control content domain constraint per search request

pull/154/head
luccioman 7 years ago
parent 36a45b3905
commit 8a4ea1c11e

@ -60,7 +60,7 @@
<label> <label>
<input type="radio" name="search.strictContentDom" value="true" #(search.strictContentDom)#::checked="checked"#(/search.strictContentDom)# />Strict <input type="radio" name="search.strictContentDom" value="true" #(search.strictContentDom)#::checked="checked"#(/search.strictContentDom)# />Strict
</label> </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). or extended to pages including such medias (provide generally more results, but eventually less relevant).
</p> </p>
</dd> </dd>

@ -138,6 +138,19 @@
<input type="checkbox" id="indexof" name="indexof" #[indexofChecked]# /> <label for="indexof">only index pages</label> <input type="checkbox" id="indexof" name="indexof" #[indexofChecked]# /> <label for="indexof">only index pages</label>
</td> </td>
</tr> </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> </table>
<h4>Query Operators</h4> <h4>Query Operators</h4>

@ -134,6 +134,9 @@ public class index {
prop.put("searchoptions_prefermaskoptions", "0"); prop.put("searchoptions_prefermaskoptions", "0");
prop.putHTML("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter); prop.putHTML("searchoptions_prefermaskoptions_prefermaskfilter", prefermaskfilter);
prop.put("searchoptions_indexofChecked", ""); 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("results", "");
prop.put("type", type); prop.put("type", type);
prop.put("depth", "0"); prop.put("depth", "0");

@ -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=""/> <input type="hidden" name="auth" id="auth" value=""/>
#(/authSearch)# #(/authSearch)#
<input type="hidden" name="contentdom" id="contentdom" value="#[contentdom]#" /> <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="former" value="#[former]#" />
<input type="hidden" name="maximumRecords" value="#[count]#" /> <input type="hidden" name="maximumRecords" value="#[count]#" />
<input type="hidden" name="startRecord" id="startRecord" value="0" /> <input type="hidden" name="startRecord" id="startRecord" value="0" />

@ -190,6 +190,7 @@ public class yacysearch {
"search.navigation", "search.navigation",
(post == null) ? sb.getConfig("search.navigation", "all") : post.get("nav", "all")); (post == null) ? sb.getConfig("search.navigation", "all") : post.get("nav", "all"));
prop.put("contentdom", "text"); prop.put("contentdom", "text");
prop.put("strictContentDom", "false");
prop.put("contentdomCheckText", "1"); prop.put("contentdomCheckText", "1");
prop.put("contentdomCheckAudio", "0"); prop.put("contentdomCheckAudio", "0");
prop.put("contentdomCheckVideo", "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.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.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("contentdom", (post == null ? "text" : post.get("contentdom", "text")));
prop.putHTML("strictContentDom", String.valueOf(strictContentDom));
// for RSS: don't HTML encode some elements // for RSS: don't HTML encode some elements
prop.putXML("rss_query", originalquerystring); 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)# #(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)# #(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> </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)# #(/searchdomswitches)#
#(nav-protocols)#:: #(nav-protocols)#::

@ -121,6 +121,8 @@ public class yacysearchtrailer {
prop.put("searchdomswitches_searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0"); prop.put("searchdomswitches_searchvideo_check", (contentdom == ContentDomain.VIDEO) ? "1" : "0");
prop.put("searchdomswitches_searchimage_check", (contentdom == ContentDomain.IMAGE) ? "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_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; String name;
int count; int count;

@ -967,6 +967,9 @@ public final class QueryParams {
sb.append("&contentdom="); sb.append("&contentdom=");
sb.append(theQuery.contentdom.toString()); sb.append(theQuery.contentdom.toString());
sb.append("&strictContentDom=");
sb.append(String.valueOf(theQuery.isStrictContentDom()));
sb.append("&former="); sb.append("&former=");
sb.append(theQuery.getQueryGoal().getQueryString(true)); sb.append(theQuery.getQueryGoal().getQueryString(true));

Loading…
Cancel
Save