allow simultaneous inurl: site: and filetype: search

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5478 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 16 years ago
parent d162cce6b4
commit c7c291bc6b

@ -27,7 +27,7 @@
<input type="hidden" name="display" value="#[display]#" />
<input name="query" id="search" type="text" size="52" maxlength="80" value="#[former]#" />
<input type="submit" name="Enter" value="Search" />
<input type="hidden" name="former" value="#[former]#" />
<!-- <input type="hidden" name="former" value="#[former]#" /> uncommented to detect newsearch //-->
<input type="hidden" name="verify" value="true" />
<div class="yacysearch">
<input type="radio" id="text" name="contentdom" value="text" #(contentdomCheckText)#::checked="checked"#(/contentdomCheckText)# /><label for="text">Text</label>&nbsp;&nbsp;

@ -119,17 +119,15 @@ public class yacysearch {
}
// collect search attributes
boolean newsearch = post.hasValue("query") && post.hasValue("former") && !post.get("query","").equalsIgnoreCase(post.get("former","")); //new search term
int itemsPerPage = Math.min((authenticated) ? 1000 : 10, post.getInt("maximumRecords", post.getInt("count", 10))); // SRU syntax with old property as alternative
int offset = (post.hasValue("query") && post.hasValue("former") && !post.get("query","").equalsIgnoreCase(post.get("former",""))) ? 0 : post.getInt("startRecord", post.getInt("offset", 0));
int offset = (newsearch) ? 0 : post.getInt("startRecord", post.getInt("offset", 0));
boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
final boolean indexof = (post != null && post.get("indexof","").equals("on"));
String urlmask = "";
if (post != null && post.containsKey("urlmask") && post.get("urlmask").equals("no")) {
urlmask = ".*";
} else {
urlmask = (post != null && post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";
}
String prefermask = (post == null ? "" : post.get("prefermaskfilter", ""));
if ((prefermask.length() > 0) && (prefermask.indexOf(".*") < 0)) prefermask = ".*" + prefermask + ".*";
@ -234,7 +232,7 @@ public class yacysearch {
String ft = querystring.substring(filetype + 9, ftb);
query[0].remove("filetype:" + ft.toLowerCase());
while(ft.startsWith(".")) ft = ft.substring(1);
if(ft.length() > 0) urlmask = ".*\\." + ft;
if(ft.length() > 0) urlmask = urlmask + ".*\\." + ft;
}
int site = querystring.indexOf("site:");
if (site >= 0) {
@ -244,8 +242,15 @@ public class yacysearch {
query[0].remove("site:" + domain.toLowerCase());
while(domain.startsWith(".")) domain = domain.substring(1);
if (domain.indexOf(".") < 0) domain = "\\." + domain; // is tld
if (domain.length() > 0) urlmask = "[a-zA-Z]*://[^/]*" + domain + "/.*";
if (domain.length() > 0) urlmask = "[a-zA-Z]*://[^/]*" + domain + "/.*" + urlmask;
}
if (urlmask.length() == 0 && post != null && post.containsKey("urlmask") && post.get("urlmask").equals("no")) { // option search all
urlmask = ".*";
} else if (urlmask.length() == 0 && !newsearch && post.containsKey("urlmaskfilter")) {
final String purlmaskfilter = post.get("urlmaskfilter", ".*");
if(!purlmaskfilter.equals(".*")) urlmask = purlmaskfilter;
}
if(urlmask.length() == 0) urlmask = ".*"; //if no urlmask was given
// read the language from the language-restrict option 'lr'
// if no one is given, use the user agent or the system language as default

Loading…
Cancel
Save