diff --git a/htroot/BlogComments.java b/htroot/BlogComments.java index 7870f1bf2..69f9cb03a 100644 --- a/htroot/BlogComments.java +++ b/htroot/BlogComments.java @@ -39,6 +39,7 @@ import net.yacy.cora.document.encoding.UTF8; import net.yacy.cora.protocol.Domains; import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.RequestHeader; +import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.ConcurrentLog; import net.yacy.data.BlogBoard; import net.yacy.data.BlogBoardComments; @@ -290,7 +291,7 @@ public class BlogComments { // get the sendmail configuration final String sendMailStr = sb.getConfig("msgForwardingCmd","/usr/bin/sendmail")+" "+sendMailTo; - final String[] sendMail = sendMailStr.trim().split(" "); + final String[] sendMail = CommonPattern.SPACE.split(sendMailStr.trim()); // build the message text final StringBuilder emailTxt = new StringBuilder(); diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index cd9c0ee39..00ae68aaf 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -452,7 +452,7 @@ public class ViewFile { words = words.substring(1, words.length() - 1); } words = UTF8.decodeURL(words); - if (words.indexOf(' ',0) >= 0) return words.split(" "); + if (words.indexOf(' ',0) >= 0) return CommonPattern.SPACE.split(words); if (words.indexOf(',',0) >= 0) return CommonPattern.COMMA.split(words); if (words.indexOf('+',0) >= 0) return words.split("\\+"); w = new String[1]; diff --git a/htroot/Vocabulary_p.java b/htroot/Vocabulary_p.java index 5c0d130a3..5be72d3c3 100644 --- a/htroot/Vocabulary_p.java +++ b/htroot/Vocabulary_p.java @@ -164,7 +164,7 @@ public class Vocabulary_p { t = t.replaceAll("_", " ").replaceAll("\"", " ").replaceAll("'", " ").replaceAll(",", " ").replaceAll(" ", " ").trim(); if (t.isEmpty()) continue; if (discoverFromTitleSplitted) { - String[] ts = t.split(" "); + String[] ts = CommonPattern.SPACE.split(t); for (String s: ts) { if (s.isEmpty()) continue; if (s.endsWith(".jpg") || s.endsWith(".gif")) continue; diff --git a/htroot/processing/domaingraph/applet/domaingraph.java b/htroot/processing/domaingraph/applet/domaingraph.java index 1e04d0b4f..d031d2a9d 100644 --- a/htroot/processing/domaingraph/applet/domaingraph.java +++ b/htroot/processing/domaingraph/applet/domaingraph.java @@ -187,7 +187,7 @@ public void processCitation(String host, HashMap props) { } public HashMap parseProps(String s) { - String[] l = s.split(" "); + String[] l = CommonPattern.SPACE.split(s); HashMap map = new HashMap(); int p; String z; diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java index 41bb6dde4..9f0aba076 100644 --- a/htroot/yacy/message.java +++ b/htroot/yacy/message.java @@ -39,6 +39,7 @@ import net.yacy.cora.document.encoding.UTF8; import net.yacy.cora.protocol.Domains; import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.RequestHeader; +import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.ConcurrentLog; import net.yacy.data.MessageBoard; import net.yacy.peers.Network; @@ -181,7 +182,7 @@ public final class message { // get the sendmail configuration final String sendMailStr = sb.getConfig("msgForwardingCmd","/usr/bin/sendmail")+" "+sendMailTo; - final String[] sendMail = sendMailStr.trim().split(" "); + final String[] sendMail = CommonPattern.SPACE.split(sendMailStr.trim()); // building the message text final StringBuilder emailTxt = new StringBuilder(); diff --git a/htroot/yacysearch_location.java b/htroot/yacysearch_location.java index 0e9f1d21b..0f1f7212b 100644 --- a/htroot/yacysearch_location.java +++ b/htroot/yacysearch_location.java @@ -30,6 +30,7 @@ import net.yacy.cora.protocol.ClientIdentification; import net.yacy.cora.protocol.Domains; import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.RequestHeader; +import net.yacy.cora.util.CommonPattern; import net.yacy.document.LibraryProvider; import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; @@ -69,7 +70,7 @@ public class yacysearch_location { int placemarkCounter = 0; if (query.length() > 0 && search_query) { final Set locations = LibraryProvider.geoLoc.find(query, true); - for (final String qp: query.split(" ")) { + for (final String qp: CommonPattern.SPACE.split(query)) { locations.addAll(LibraryProvider.geoLoc.find(qp, true)); } String ip = sb.peers.mySeed().getIP(); diff --git a/source/net/yacy/data/DidYouMean.java b/source/net/yacy/data/DidYouMean.java index f0050173b..813414092 100644 --- a/source/net/yacy/data/DidYouMean.java +++ b/source/net/yacy/data/DidYouMean.java @@ -20,6 +20,7 @@ import org.apache.solr.common.SolrException; import net.yacy.cora.sorting.ClusteredScoreMap; import net.yacy.cora.sorting.OrderedScoreMap; import net.yacy.cora.sorting.ReversibleScoreMap; +import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.StringBuilderComparator; import net.yacy.document.LibraryProvider; @@ -246,7 +247,7 @@ public class DidYouMean { if (sp >= 0) s = s.substring(0, sp); sp = s.indexOf(""); if (sp >= 0) s = s.substring(0, sp).trim(); - String[] sx = s.split(" "); + String[] sx = CommonPattern.SPACE.split(s); StringBuilder sb = new StringBuilder(s.length()); for (String x: sx) if (x.length() > 1 && sb.length() < 28) sb.append(x).append(' '); else break; s = sb.toString().trim(); diff --git a/source/net/yacy/data/ymark/YMarkAutoTagger.java b/source/net/yacy/data/ymark/YMarkAutoTagger.java index 1c2afa2a6..8a0be1e60 100644 --- a/source/net/yacy/data/ymark/YMarkAutoTagger.java +++ b/source/net/yacy/data/ymark/YMarkAutoTagger.java @@ -14,6 +14,7 @@ import net.yacy.cora.document.id.DigestURL; import net.yacy.cora.document.id.MultiProtocolURL; import net.yacy.cora.federate.yacy.CacheStrategy; import net.yacy.cora.protocol.ClientIdentification; +import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.ConcurrentLog; import net.yacy.crawler.retrieval.Response; import net.yacy.document.Condenser; @@ -105,7 +106,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle score = 10; final String phrase = iter.next(); if(phrases.get(phrase).size() > 3 && phrases.get(phrase).size() < 10) { - score = phrases.get(phrase).size() * phrase.split(" ").length * 20; + score = phrases.get(phrase).size() * CommonPattern.SPACE.split(phrase).length * 20; } if(isDigitSpace(phrase)) { score = 10; diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.java index e66963ae1..c03c162eb 100644 --- a/source/net/yacy/search/schema/CollectionConfiguration.java +++ b/source/net/yacy/search/schema/CollectionConfiguration.java @@ -687,7 +687,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri imgprots.add(protocol); imgstubs[i] = uri.toString().substring(protocol.length() + 3); imgalts[i] = ie.alt(); - for (String it: uri.toTokens().split(" ")) images_text_map.add(it); + for (String it: CommonPattern.SPACE.split(uri.toTokens())) images_text_map.add(it); if (ie.alt() != null && ie.alt().length() > 0) { SentenceReader sr = new SentenceReader(ie.alt()); while (sr.hasNext()) images_text_map.add(sr.next().toString()); @@ -906,7 +906,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri if (content == null || content.length() == 0) { content = tokens; } else { - String[] t = tokens.split(" "); + String[] t = CommonPattern.SPACE.split(tokens); for (String r: t) { if (r.length() > 0 && content.indexOf(" " + r + " ") < 0 && diff --git a/test/net/yacy/search/snippet/TextSnippetTest.java b/test/net/yacy/search/snippet/TextSnippetTest.java index e6b4330d6..d8392c4db 100644 --- a/test/net/yacy/search/snippet/TextSnippetTest.java +++ b/test/net/yacy/search/snippet/TextSnippetTest.java @@ -66,7 +66,7 @@ public class TextSnippetTest { String rstr = ts.getError(); assertEquals("testTextSnippet Error Code: ", "", rstr); - String[] wordlist = querywords.split(" "); + String[] wordlist = CommonPattern.SPACE.split(querywords); rstr = ts.toString(); System.out.println("testTextSnippet: query=" + querywords); System.out.println("testTextSnippet: snippet=" + rstr); @@ -111,7 +111,7 @@ public class TextSnippetTest { rstr = ts.getLineMarked(qg); System.out.println("testGetLineMarked: query=" + querywords); System.out.println("testGetLineMarked: snippet=" + rstr); - String[] wordlist = querywords.split(" "); + String[] wordlist = CommonPattern.SPACE.split(querywords); for (String wordstr : wordlist) { assertTrue("testGetLineMarked marked word " + wordstr, rstr.contains("" + wordstr + "")); }