Merge branch 'master' of ssh://git@gitorious.org/yacy/rc1.git

pull/1/head
orbiter 11 years ago
commit 22e3524797

@ -177,9 +177,9 @@ public class SettingsAck_p {
if (post.containsKey("httpNetworking")) {
// set transparent proxy flag
HTTPDProxyHandler.isTransparentProxy = post.containsKey("isTransparentProxy");
env.setConfig("isTransparentProxy", HTTPDProxyHandler.isTransparentProxy);
prop.put("info_isTransparentProxy", HTTPDProxyHandler.isTransparentProxy ? "on" : "off");
boolean isTransparentProxy = post.containsKey("isTransparentProxy");
env.setConfig("isTransparentProxy", isTransparentProxy);
prop.put("info_isTransparentProxy", isTransparentProxy ? "on" : "off");
// setting the keep alive property
HTTPDemon.keepAliveSupport = post.containsKey("connectionKeepAliveSupport");

@ -86,19 +86,18 @@ public class yacysearchtrailer {
break;
}
nav = "inurl%3A" + name;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (!theSearch.query.modifier.toString().contains(nav)) {
if (!theSearch.query.modifier.toString().contains("inurl:"+name)) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-namespace_element_" + i + "_on", 1);
prop.put(fileType, "nav-namespace_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-namespace_element_" + i + "_on", 0);
prop.put(fileType, "nav-namespace_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-namespace_element_" + i + "_name", name);
prop.put(fileType, "nav-namespace_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-namespace_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-namespace_element_" + i + "_count", count);
prop.put("nav-namespace_element_" + i + "_nl", 1);
i++;
@ -129,19 +128,18 @@ public class yacysearchtrailer {
break;
}
nav = "site%3A" + name;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (theSearch.query.modifier.sitehost == null || !theSearch.query.modifier.sitehost.contains(name)) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-domains_element_" + i + "_on", 1);
prop.put(fileType, "nav-domains_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-domains_element_" + i + "_on", 0);
prop.put(fileType, "nav-domains_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-domains_element_" + i + "_name", name);
prop.put(fileType, "nav-domains_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-domains_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-domains_element_" + i + "_count", count);
prop.put("nav-domains_element_" + i + "_nl", 1);
i++;
@ -156,7 +154,7 @@ public class yacysearchtrailer {
}
}
// host navigators
// language navigators
final ScoreMap<String> languageNavigator = theSearch.languageNavigator;
if (languageNavigator == null || languageNavigator.isEmpty()) {
prop.put("nav-languages", 0);
@ -172,20 +170,19 @@ public class yacysearchtrailer {
break;
}
nav = "%2Flanguage%2F" + name;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (theSearch.query.modifier.language == null || !theSearch.query.modifier.language.contains(name)) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-languages_element_" + i + "_on", 1);
prop.put(fileType, "nav-languages_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-languages_element_" + i + "_on", 0);
prop.put(fileType, "nav-languages_element_" + i + "_modifier", "-" + nav);
nav="";
}
String longname = ISO639.country(name);
prop.put(fileType, "nav-languages_element_" + i + "_name", longname == null ? name : longname);
prop.put(fileType, "nav-languages_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-languages_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-languages_element_" + i + "_count", count);
prop.put("nav-languages_element_" + i + "_nl", 1);
i++;
@ -215,19 +212,18 @@ public class yacysearchtrailer {
break;
}
nav = (name.indexOf(' ', 0) < 0) ? "author%3A" + name : "author%3A%28" + name.replace(" ", "+") + "%29";
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (theSearch.query.modifier.author == null || !theSearch.query.modifier.author.contains(name)) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-authors_element_" + i + "_on", 1);
prop.put(fileType, "nav-authors_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-authors_element_" + i + "_on", 0);
prop.put(fileType, "nav-authors_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-authors_element_" + i + "_name", name);
prop.put(fileType, "nav-authors_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-authors_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-authors_element_" + i + "_count", count);
prop.put("nav-authors_element_" + i + "_nl", 1);
i++;
@ -250,7 +246,6 @@ public class yacysearchtrailer {
prop.put("nav-topics", "1");
navigatorIterator = topicNavigator.keys(false);
int i = 0;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
// first sort the list to a form where the greatest element is in the middle
LinkedList<Map.Entry<String, Integer>> cloud = new LinkedList<Map.Entry<String, Integer>>();
while (i < MAX_TOPWORDS && navigatorIterator.hasNext()) {
@ -269,7 +264,7 @@ public class yacysearchtrailer {
prop.put("nav-topics_element_" + i + "_on", 1);
prop.put(fileType, "nav-topics_element_" + i + "_modifier", name);
prop.put(fileType, "nav-topics_element_" + i + "_name", name);
prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl + "+" + name).toString());
prop.put(fileType, "nav-topics_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, name).toString());
prop.put("nav-topics_element_" + i + "_count", count);
prop.put("nav-topics_element_" + i + "_nl", 1);
i++;
@ -296,19 +291,18 @@ public class yacysearchtrailer {
}
visible = visible || "ftp,smb".indexOf(name) >= 0;
nav = "%2F" + name;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (theSearch.query.modifier.protocol == null || !theSearch.query.modifier.protocol.contains(name)) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-protocols_element_" + i + "_on", 1);
prop.put(fileType, "nav-protocols_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-protocols_element_" + i + "_on", 0);
prop.put(fileType, "nav-protocols_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-protocols_element_" + i + "_name", name);
prop.put(fileType, "nav-protocols_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-protocols_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-protocols_element_" + i + "_count", count);
prop.put("nav-protocols_element_" + i + "_nl", 1);
i++;
@ -340,19 +334,18 @@ public class yacysearchtrailer {
}
visible = visible || Classification.isMediaExtension(name) || "pdf,doc,docx".indexOf(name) >= 0;
nav = "filetype%3A" + name;
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (theSearch.query.modifier.filetype == null || !theSearch.query.modifier.filetype.contains(name) ) {
pos++;
queryStringForUrl += "+" + nav;
prop.put("nav-filetypes_element_" + i + "_on", 1);
prop.put(fileType, "nav-filetypes_element_" + i + "_modifier", nav);
} else {
neg++;
prop.put("nav-filetypes_element_" + i + "_on", 0);
prop.put(fileType, "nav-filetypes_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-filetypes_element_" + i + "_name", name);
prop.put(fileType, "nav-filetypes_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-filetypes_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-filetypes_element_" + i + "_count", count);
prop.put("nav-filetypes_element_" + i + "_nl", 1);
i++;
@ -387,17 +380,16 @@ public class yacysearchtrailer {
break;
}
nav = "%2Fvocabulary%2F" + navname + "%2F" + MultiProtocolURL.escape(Tagging.encodePrintname(name)).toString();
String queryStringForUrl = theSearch.query.getQueryGoal().getQueryString(true);
if (!theSearch.query.modifier.toString().contains("/vocabulary/")) {
queryStringForUrl += "+" + nav;
if (!theSearch.query.modifier.toString().contains("/vocabulary/"+navname+"/"+name)) {
prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_on", 1);
prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_modifier", nav);
} else {
prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_on", 0);
prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_modifier", "-" + nav);
nav="";
}
prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_name", name);
prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, queryStringForUrl).toString());
prop.put(fileType, "nav-vocabulary_" + navvoccount + "_element_" + i + "_url", QueryParams.navurl(fileType.name().toLowerCase(), 0, theSearch.query, nav).toString());
prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_count", count);
prop.put("nav-vocabulary_" + navvoccount + "_element_" + i + "_nl", 1);
i++;

@ -170,10 +170,17 @@ public class QueryModifier {
if (m != null) modifier.append(m);
}
@Override
public String toString() {
return this.modifier.toString();
}
/**
* @return true if no modifier active
*/
public boolean isEmpty() {
return this.modifier.length() == 0;
}
private StringBuilder apply(String FQ) {

@ -608,13 +608,33 @@ public final class QueryParams {
return sb;
}
public static StringBuilder navurlBase(final String ext, final QueryParams theQuery, final String newQueryString) {
/**
* construct navigator url
*
* @param ext extension of servlet (e.g. html, rss)
* @param theQuery search query
* @param newModifier optional new modifier.
* - if null existing modifier of theQuery is appended
* - if not null this new modifier is appended in addition to existing modifier
* - if isEmpty overwrites (clears) existing modifier
* @return url to new search result page
*/
public static StringBuilder navurlBase(final String ext, final QueryParams theQuery, final String newModifier) {
final StringBuilder sb = new StringBuilder(120);
sb.append("/yacysearch.");
sb.append(ext);
sb.append("?query=");
sb.append(newQueryString == null ? theQuery.getQueryGoal().getQueryString(true) : newQueryString);
sb.append(theQuery.getQueryGoal().getQueryString(true));
if (newModifier == null) {
if (!theQuery.modifier.isEmpty()) sb.append("+" + theQuery.modifier.toString());
} else {
if(!newModifier.isEmpty()) {
if (!theQuery.modifier.isEmpty()) sb.append("+" + theQuery.modifier.toString());
sb.append("+" + newModifier);
}
}
sb.append("&maximumRecords=");
sb.append(theQuery.itemsPerPage());

@ -100,7 +100,6 @@ public final class HTTPDProxyHandler {
private static final HashSet<String> yellowList;
private static int timeout = 60000;
private static boolean yacyTrigger = true;
public static boolean isTransparentProxy = false;
private static Process redirectorProcess = null;
private static boolean redirectorEnabled = false;
private static PrintWriter redirectorWriter = null;
@ -113,7 +112,6 @@ public final class HTTPDProxyHandler {
// creating a logger
private static final ConcurrentLog log = new ConcurrentLog("PROXY");
private static boolean doAccessLogging = false;
/**
* Do logging configuration for special proxy access log file
*/
@ -123,13 +121,11 @@ public final class HTTPDProxyHandler {
sb = Switchboard.getSwitchboard();
if (sb != null) {
isTransparentProxy = Boolean.parseBoolean(sb.getConfig("isTransparentProxy","false"));
// set timeout
timeout = Integer.parseInt(sb.getConfig("proxy.clientTimeout", "60000"));
// create a htRootPath: system pages
htRootPath = new File(sb.getAppPath(), sb.getConfig("htRootPath","htroot"));
htRootPath = new File(sb.getAppPath(), sb.getConfig(SwitchboardConstants.HTROOT_PATH,SwitchboardConstants.HTROOT_PATH_DEFAULT));
if (!(htRootPath.exists())) {
if(!htRootPath.mkdir())
ConcurrentLog.severe("PROXY", "could not create htRoot "+ htRootPath);
@ -170,7 +166,6 @@ public final class HTTPDProxyHandler {
txtLog.setLevel(Level.FINEST);
proxyLogger.addHandler(txtLog);
doAccessLogging = true;
log.info("Proxy access logging configuration done." +
"\n\tFilename: " + pattern +
"\n\tLimit: " + limitStr +
@ -1173,8 +1168,6 @@ public final class HTTPDProxyHandler {
*/
private final static synchronized void logProxyAccess(final HashMap<String, Object> conProp) {
if (!doAccessLogging) return;
logMessage.setLength(0);
// Timestamp

Loading…
Cancel
Save