Skip to content

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

- added text/image/audio/video/app search option to new navigation bar - changed colors of privacy selector

Michael Peter Christene3cb0ffe1618
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 1b37a4a5a..d951c76a0 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -93,20 +93,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<button id="Enter" class="btn btn-default" type="submit">search</button>
</div>
</div>
-
- <!--
- #(searchdomswitches)#::
- <div class="yacysearch">
- #(searchtext)#::<input type="radio" id="text" name="contentdom" value="text" #(check)#::checked="checked"#(/check)# />&nbsp;Text&nbsp;&nbsp;#(/searchtext)#
- #(searchimage)#::<input type="radio" id="image" name="contentdom" value="image" #(check)#::checked="checked"#(/check)# />&nbsp;Images&nbsp;&nbsp;#(/searchimage)#
- #(searchaudio)#::<input type="radio" id="audio" name="contentdom" value="audio" #(check)#::checked="checked"#(/check)# />&nbsp;Audio&nbsp;&nbsp;#(/searchaudio)#
- #(searchvideo)#::<input type="radio" id="video" name="contentdom" value="video" #(check)#::checked="checked"#(/check)# />&nbsp;Video&nbsp;&nbsp;#(/searchvideo)#
- #(searchapp)#::<input type="radio" id="app" name="contentdom" value="app" #(check)#::checked="checked"#(/check)# />&nbsp;Applications#(/searchapp)#
- &nbsp;
- <a href="index.html?searchoptions=2&amp;count=#[count]#&amp;prefermaskfilter=#[prefermaskfilter]#&amp;cat=#[cat]#&amp;constraint=#[constraint]#&amp;contentdom=#[contentdom]#&amp;former=#[former]#&amp;meanCount=#[meanCount]#">more options</a>
- </div>
- #(/searchdomswitches)#
- -->
+ <input type="hidden" name="contentdom" id="contentdom" value="#[contentdom]#" />
<input type="hidden" name="former" value="#[former]#" />
<input type="hidden" name="maximumRecords" value="#[count]#" />
<input type="hidden" name="startRecord" id="startRecord" value="0" />
@@ -118,7 +105,6 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<input type="hidden" name="cat" value="#[cat]#" />
<input type="hidden" name="constraint" value="#[constraint]#" />
<input type="hidden" name="meanCount" value="#[meanCount]#" />
-
</form>
<!-- type the number of results and navigation bar -->
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 73224762b..634b8663c 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -264,8 +264,7 @@ public class yacysearch {
}
// find search domain
- final Classification.ContentDomain contentdom =
- ContentDomain.contentdomParser(post == null ? "all" : post.get("contentdom", "all"));
+ final Classification.ContentDomain contentdom = ContentDomain.contentdomParser(post == null ? "all" : post.get("contentdom", "all"));
// patch until better search profiles are available
if (contentdom == ContentDomain.IMAGE && (itemsPerPage == 10 || itemsPerPage == 100)) {
@@ -835,12 +834,7 @@ public class yacysearch {
prop.put("results_" + i + "_eventID", theQuery.id(false));
}
prop.put("results", theQuery.itemsPerPage());
- prop
- .put(
- "resultTable",
- (contentdom == ContentDomain.APP || contentdom == ContentDomain.AUDIO || contentdom == ContentDomain.VIDEO)
- ? 1
- : 0);
+ prop.put("resultTable", (contentdom == ContentDomain.APP || contentdom == ContentDomain.AUDIO || contentdom == ContentDomain.VIDEO) ? 1 : 0);
prop.put("eventID", theQuery.id(false)); // for bottomline
// process result of search
@@ -881,33 +875,6 @@ public class yacysearch {
"search.navigation",
(post == null) ? sb.getConfig("search.navigation", "all") : post.get("nav", "all"));
prop.put("contentdom", (post == null ? "text" : post.get("contentdom", "text")));
- prop.put(
- "searchdomswitches",
- sb.getConfigBool("search.text", true)
- || sb.getConfigBool("search.audio", true)
- || sb.getConfigBool("search.video", true)
- || sb.getConfigBool("search.image", true)
- || sb.getConfigBool("search.app", true) ? 1 : 0);
- prop.put("searchdomswitches_searchtext", sb.getConfigBool("search.text", true) ? 1 : 0);
- prop.put("searchdomswitches_searchaudio", sb.getConfigBool("search.audio", true) ? 1 : 0);
- prop.put("searchdomswitches_searchvideo", sb.getConfigBool("search.video", true) ? 1 : 0);
- prop.put("searchdomswitches_searchimage", sb.getConfigBool("search.image", true) ? 1 : 0);
- prop.put("searchdomswitches_searchapp", sb.getConfigBool("search.app", true) ? 1 : 0);
- prop.put("searchdomswitches_searchtext_check", (contentdom == ContentDomain.TEXT || contentdom == ContentDomain.ALL) ? "1" : "0");
- prop.put("searchdomswitches_searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "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_searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
-
- // copy properties for "more options" link
- prop.put("searchdomswitches_count", prop.get("count"));
- prop.put("searchdomswitches_urlmaskfilter", prop.get("urlmaskfilter"));
- prop.put("searchdomswitches_prefermaskfilter", prop.get("prefermaskfilter"));
- prop.put("searchdomswitches_cat", prop.get("cat"));
- prop.put("searchdomswitches_constraint", prop.get("constraint"));
- prop.put("searchdomswitches_contentdom", prop.get("contentdom"));
- prop.put("searchdomswitches_former", prop.get("former"));
- prop.put("searchdomswitches_meanCount", prop.get("meanCount"));
// for RSS: don't HTML encode some elements
prop.putXML("rss_query", originalquerystring);
diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html
index 35b4c8610..e29cd5eda 100644
--- a/htroot/yacysearchtrailer.html
+++ b/htroot/yacysearchtrailer.html
@@ -13,7 +13,8 @@
data-label-text="Privacy"
data-on-text="<span style='padding:0 20px 0 20px;'>Peer-to-Peer</span>"
data-off-text="<span style='padding:0 20px 0 20px;'>Stealth&nbsp;Mode</span>"
- type="checkbox" name="resource-switch" value="local" data-size="large" style="width:100%"
+ data-on-color="warning" data-off-color="success"
+ type="checkbox" name="resource-switch" value="local" data-size="large"
onchange="document.getElementById('resource').value='local';document.searchform.submit();">
<script>$("[name='resource-switch']").bootstrapSwitch();</script>
</form>
@@ -26,7 +27,8 @@
data-label-text="Privacy"
data-on-text="<span style='padding:0 20px 0 20px';>Peer-to-Peer</span>"
data-off-text="<span style='padding:0 20px 0 20px;'>Stealth&nbsp;Mode</span>"
- type="checkbox" name="resource-switch" value="global" data-size="large" style="width:100%"
+ data-on-color="warning" data-off-color="success"
+ type="checkbox" name="resource-switch" value="global" data-size="large"
onchange="document.getElementById('resource').value='global';document.searchform.submit();">
<script>$("[name='resource-switch']").bootstrapSwitch();</script>
</form>
@@ -35,6 +37,16 @@
-->
#(/resource-select)#
+#(searchdomswitches)#::<p>
+<div class="btn-group btn-group-justified">
+ #(searchtext)#::<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(check)#:: active#(/check)#"#(check)#onclick="document.getElementById('contentdom').value='text';document.searchform.submit();"::#(/check)#>Text</button></div>#(/searchtext)#
+ #(searchimage)#::<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(check)#:: active#(/check)#"#(check)#onclick="document.getElementById('contentdom').value='image';document.searchform.submit();"::#(/check)#>Images</button></div>#(/searchimage)#
+ #(searchaudio)#::<div class="btn-group btn-group-xs"><button type="button" class="btn btn-default#(check)#:: active#(/check)#"#(check)#onclick="document.getElementById('contentdom').value='audio';document.searchform.submit();"::#(/check)#>Audio</button></div>#(/searchaudio)#
+ #(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>
+</p>#(/searchdomswitches)#
+
#(cat-location)#::
<a href="yacysearch_location.html?query=#[queryenc]#">
<img src="env/grafics/earthsearch.png" width="215" height="159" alt="earthsearchlogo" /></a>
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index e640d07df..eafbbe0a7 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -30,6 +30,7 @@ import java.util.LinkedList;
import java.util.Map;
import net.yacy.cora.document.analysis.Classification;
+import net.yacy.cora.document.analysis.Classification.ContentDomain;
import net.yacy.cora.document.id.MultiProtocolURL;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.protocol.RequestHeader;
@@ -68,7 +69,6 @@ public class yacysearchtrailer {
boolean global = post == null || (!post.get("resource-switch", post.get("resource", "global")).equals("local") && p2pmode);
boolean stealthmode = p2pmode && !global;
prop.put("resource-select", !authorized ? 0 : stealthmode ? 2 : global ? 1 : 0);
-
// find search event
final SearchEvent theSearch = SearchEventCache.getEvent(eventID);
if (theSearch == null) {
@@ -78,7 +78,24 @@ public class yacysearchtrailer {
final RequestHeader.FileType fileType = header.fileType();
// compose search navigation
-
+ ContentDomain contentdom = theSearch.getQuery().contentdom;
+ prop.put("searchdomswitches",
+ sb.getConfigBool("search.text", true)
+ || sb.getConfigBool("search.audio", true)
+ || sb.getConfigBool("search.video", true)
+ || sb.getConfigBool("search.image", true)
+ || sb.getConfigBool("search.app", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchtext", sb.getConfigBool("search.text", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchaudio", sb.getConfigBool("search.audio", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchvideo", sb.getConfigBool("search.video", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchimage", sb.getConfigBool("search.image", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchapp", sb.getConfigBool("search.app", true) ? 1 : 0);
+ prop.put("searchdomswitches_searchtext_check", (contentdom == ContentDomain.TEXT || contentdom == ContentDomain.ALL) ? "1" : "0");
+ prop.put("searchdomswitches_searchaudio_check", (contentdom == ContentDomain.AUDIO) ? "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_searchapp_check", (contentdom == ContentDomain.APP) ? "1" : "0");
+
// namespace navigators
String name;
int count;