mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
enhancements for extended search options
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@8053 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
4f95f72124
commit
aca0f33f08
|
@ -80,23 +80,19 @@
|
|||
#(searchaudio)#::<input type="radio" id="audio" name="contentdom" value="audio" #(check)#::checked="checked"#(/check)# /><label for="audio">Audio</label> #(/searchaudio)#
|
||||
#(searchvideo)#::<input type="radio" id="video" name="contentdom" value="video" #(check)#::checked="checked"#(/check)# /><label for="video">Video</label> #(/searchvideo)#
|
||||
#(searchapp)#::<input type="radio" id="app" name="contentdom" value="app" #(check)#::checked="checked"#(/check)# /><label for="app">Applications</label>#(/searchapp)#
|
||||
#(searchoptions)# <a href="/index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&former='+document.getElementById('searchform').search.value+'&contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a>::#(/searchoptions)#
|
||||
</div>
|
||||
#(/searchdomswitches)#
|
||||
<input type="hidden" name="nav" value="#[search.navigation]#" />
|
||||
<input type="hidden" name="startRecord" value="0" />
|
||||
<input type="hidden" name="indexof" value="off" />
|
||||
<input type="hidden" name="meanCount" value="5" />
|
||||
<input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
|
||||
#(searchoptions)#
|
||||
<input type="hidden" name="resource" value="global" />
|
||||
<input type="hidden" name="urlmaskfilter" value=".*" />
|
||||
<input type="hidden" name="prefermaskfilter" value="" />
|
||||
::
|
||||
<input type="hidden" name="resource" value="global" />
|
||||
<input type="hidden" name="urlmaskfilter" value=".*" />
|
||||
<input type="hidden" name="prefermaskfilter" value="" />
|
||||
<input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
|
||||
</fieldset>
|
||||
<p><a href="/index.html?searchoptions=2" onclick="this.href='/index.html?searchoptions=2&former='+document.getElementById('searchform').search.value+'&contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a></p>
|
||||
::
|
||||
</fieldset>
|
||||
|
||||
|
@ -104,28 +100,17 @@
|
|||
<tr>
|
||||
<td><label for="count">Max. number of results</label>:</td>
|
||||
<td>
|
||||
<select id="count" name="count">
|
||||
<option #(count-10)#::selected="selected"#(/count-10)#>10</option>
|
||||
<option #(count-50)#::selected="selected"#(/count-50)#>50</option>
|
||||
<option #(count-100)#::selected="selected"#(/count-100)#>100</option>
|
||||
</select>
|
||||
<input type="radio" name="maximumRecords" value="10" #(count-10)#::checked="checked"#(/count-10)#/>10
|
||||
<input type="radio" name="maximumRecords" value="50" #(count-50)#::checked="checked"#(/count-50)#/>50
|
||||
<input type="radio" name="maximumRecords" value="100" #(count-100)#::checked="checked"#(/count-100)#/>100
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
#(resource-select)#::
|
||||
<td><label for="resource">Resource</label>:</td>
|
||||
<td>
|
||||
<select id="resource" name="resource">
|
||||
<option value="global" #(global)#::selected="selected"#(/global)#
|
||||
#(global-disabled)#::disabled="disabled"#(/global-disabled)#>global</option>
|
||||
<option value="local" #(local)#::selected="selected"#(/local)#>local</option>
|
||||
</select>
|
||||
#(global-disabled)#::
|
||||
Global search is disabled because<br />#(reason)#
|
||||
<a class="lock" href="ConfigNetwork_p.html">DHT Distribution</a> is::
|
||||
<a class="lock" href="ConfigNetwork_p.html">Index Receive</a> is::
|
||||
<a class="lock" href="ConfigNetwork_p.html">DHT Distribution and Index Receive</a> are#(/reason)#
|
||||
disabled.#(/global-disabled)#
|
||||
<input type="radio" name="resource" value="global" #(global)#::checked="checked"#(/global)# #(global-disabled)#::disabled="disabled"#(/global-disabled)#/>global
|
||||
<input type="radio" name="resource" value="local" #(local)#::checked="checked"#(/local)#/>local
|
||||
</td>
|
||||
#(/resource-select)#
|
||||
</tr>
|
||||
|
@ -163,7 +148,7 @@
|
|||
<tr><td></td><td></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://www.yacy-websuche.de/wiki/index.php/En:SearchParameters">advanced parameters</a>
|
||||
<a href="http://www.yacy-websuche.de/wiki/index.php/En:SearchParameters">help: advanced parameters</a>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// $LastChangedBy$
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
|
@ -41,15 +41,15 @@ public class index {
|
|||
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
||||
final Switchboard sb = (Switchboard) env;
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
String forwardTarget = sb.getConfig(SwitchboardConstants.INDEX_FORWARD, "");
|
||||
|
||||
final String forwardTarget = sb.getConfig(SwitchboardConstants.INDEX_FORWARD, "");
|
||||
if (forwardTarget.length() > 0) {
|
||||
// forward the page
|
||||
prop.put("forward", 1);
|
||||
prop.put("forward_target", forwardTarget);
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
||||
// access control
|
||||
final boolean authorizedAccess = sb.verifyAuthentication(header, false);
|
||||
if ((post != null) && (post.containsKey("publicPage"))) {
|
||||
|
@ -58,10 +58,10 @@ public class index {
|
|||
return prop;
|
||||
}
|
||||
}
|
||||
|
||||
final boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
|
||||
|
||||
int searchoptions = (post == null) ? 1 : post.getInt("searchoptions", 1);
|
||||
boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
|
||||
|
||||
int searchoptions = (post == null) ? 0 : Math.min(1, post.getInt("searchoptions", 0));
|
||||
if (!sb.getConfigBool("search.options", true)) searchoptions = 0;
|
||||
final String former = (post == null) ? "" : post.get("former", "");
|
||||
final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));
|
||||
|
@ -71,12 +71,12 @@ public class index {
|
|||
final String constraint = (post == null) ? "" : post.get("constraint", "");
|
||||
final String cat = (post == null) ? "href" : post.get("cat", "href");
|
||||
final int type = (post == null) ? 0 : post.getInt("type", 0);
|
||||
|
||||
final boolean indexDistributeGranted = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
|
||||
|
||||
//final boolean indexDistributeGranted = sb.getConfigBool(SwitchboardConstants.INDEX_DIST_ALLOW, true);
|
||||
final boolean indexReceiveGranted = sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_ALLOW, true) ||
|
||||
sb.getConfigBool(SwitchboardConstants.INDEX_RECEIVE_AUTODISABLED, true);
|
||||
//global = global && indexDistributeGranted && indexReceiveGranted;
|
||||
|
||||
global = global && indexReceiveGranted;
|
||||
|
||||
// search domain
|
||||
ContentDomain contentdom = ContentDomain.TEXT;
|
||||
final String cds = (post == null) ? "text" : post.get("contentdom", "text");
|
||||
|
@ -85,7 +85,7 @@ public class index {
|
|||
if (cds.equals("video")) contentdom = ContentDomain.VIDEO;
|
||||
if (cds.equals("image")) contentdom = ContentDomain.IMAGE;
|
||||
if (cds.equals("app")) contentdom = ContentDomain.APP;
|
||||
|
||||
|
||||
// we create empty entries for template strings
|
||||
String promoteSearchPageGreeting = env.getConfig(SwitchboardConstants.GREETING, "");
|
||||
if (env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) promoteSearchPageGreeting = env.getConfig("network.unit.description", "");
|
||||
|
@ -102,10 +102,9 @@ public class index {
|
|||
prop.put("searchoptions_count-10", (count == 10) ? "1" : "0");
|
||||
prop.put("searchoptions_count-50", (count == 50) ? "1" : "0");
|
||||
prop.put("searchoptions_count-100", (count == 100) ? "1" : "0");
|
||||
prop.put("searchoptions_resource-select", (sb.peers == null) ? 0 : sb.peers.sizeConnected() > 0 ? 1 : 0);
|
||||
prop.put("searchoptions_resource-select", (sb.peers == null || sb.peers.sizeConnected() == 0 || !global) ? 0 : 1);
|
||||
prop.put("searchoptions_resource-select_global", global ? "1" : "0");
|
||||
prop.put("searchoptions_resource-select_global-disabled", (indexReceiveGranted && indexDistributeGranted) ? "0" : "1");
|
||||
prop.put("searchoptions_resource-select_global-disabled_reason", (indexReceiveGranted) ? "0" : (indexDistributeGranted ? "1" : "2"));
|
||||
prop.put("searchoptions_resource-select_global-disabled", indexReceiveGranted ? "0" : "1");
|
||||
prop.put("searchoptions_resource-select_local", global ? "0" : "1");
|
||||
prop.put("searchoptions_urlmaskoptions", "0");
|
||||
prop.putHTML("searchoptions_urlmaskoptions_urlmaskfilter", urlmaskfilter);
|
||||
|
@ -120,6 +119,7 @@ public class index {
|
|||
prop.put("pi", sb.getConfigBool("publicAdministratorPi", false) ? 1 : 0);
|
||||
prop.putHTML("constraint", constraint);
|
||||
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_searchoptions", searchoptions);
|
||||
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);
|
||||
|
@ -134,7 +134,7 @@ public class index {
|
|||
prop.put("search.verify", sb.getConfig("search.verify", "iffresh") );
|
||||
// online caution timing
|
||||
sb.localSearchLastAccess = System.currentTimeMillis();
|
||||
|
||||
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user