Skip to content

Commit

Permalink
Added UI switch to control content domain constraint per search request
Browse files Browse the repository at this point in the history
  • Loading branch information
luccioman committed Jan 2, 2018
1 parent 36a45b3 commit 8a4ea1c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion htroot/ConfigPortal_p.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h2>Integration of a Search Portal</h2>
<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>
Expand Down
13 changes: 13 additions & 0 deletions htroot/index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ <h2 class="yacy">#[promoteSearchPageGreeting]#</h2>
<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>
Expand Down
3 changes: 3 additions & 0 deletions htroot/index.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public static serverObjects respond(final RequestHeader header, final serverObje
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");
Expand Down
1 change: 1 addition & 0 deletions htroot/yacysearch.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
<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" />
Expand Down
2 changes: 2 additions & 0 deletions htroot/yacysearch.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public static serverObjects respond(
"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");
Expand Down Expand Up @@ -965,6 +966,7 @@ public static serverObjects respond(
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);
Expand Down
6 changes: 6 additions & 0 deletions htroot/yacysearchtrailer.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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)#::
Expand Down
2 changes: 2 additions & 0 deletions htroot/yacysearchtrailer.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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_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;
Expand Down
3 changes: 3 additions & 0 deletions source/net/yacy/search/query/QueryParams.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -967,6 +967,9 @@ public static StringBuilder navurlBase(final RequestHeader.FileType ext, final Q


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));
Expand Down

0 comments on commit 8a4ea1c

Please sign in to comment.