Skip to content

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

fix error on *abc query input http://mantis.tokeek.de/view.php?id=486

regerb2412646324a
diff --git a/source/net/yacy/search/query/QueryModifier.java b/source/net/yacy/search/query/QueryModifier.java
index 2bdf35454..c89dea553 100644
--- a/source/net/yacy/search/query/QueryModifier.java
+++ b/source/net/yacy/search/query/QueryModifier.java
@@ -85,9 +85,12 @@ public class QueryModifier {
}
// parse 'common search mistakes' like guessed regular expressions
+ // (changes "abc*" to "ab", "abc *def" to "abcdef") TODO: handle most common "abc*"
int p = querystring.indexOf('*');
- if ((p >= 0) && ((p > 0 && querystring.charAt(p - 1) != ' ') || (p < querystring.length() - 1 && querystring.charAt(p + 1) != ' '))) querystring = querystring.substring(0, p - 1) + querystring.substring(p + 1);
-
+ if ((p >= 0) && ((p > 0 && querystring.charAt(p - 1) != ' ') || (p > 1 && p < querystring.length() - 1 && querystring.charAt(p + 1) != ' '))) {
+ querystring = querystring.substring(0, p - 1) + querystring.substring(p + 1);
+ }
+
// parse filetype
querystring = filetypeParser(querystring, "filetype:");