From ac19690d3057ce49534ec176d36092b98d3f7495 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 29 Jan 2015 01:35:28 +0100 Subject: [PATCH] refactoring with CommonPattern.COMMA --- defaults/yacy.init | 1 + source/net/yacy/cora/lod/vocabulary/Tagging.java | 9 +++++---- source/net/yacy/data/ListManager.java | 9 ++++----- source/net/yacy/kelondro/index/Row.java | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/defaults/yacy.init b/defaults/yacy.init index 26f39e883..6f21e0e2d 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -830,6 +830,7 @@ search.result.show.cache = true search.result.show.proxy = false search.result.show.hostbrowser = true search.result.show.vocabulary = false +search.result.show.vocabulary.omit = # search navigators: comma-separated list of default values for search navigation. diff --git a/source/net/yacy/cora/lod/vocabulary/Tagging.java b/source/net/yacy/cora/lod/vocabulary/Tagging.java index 1227e35bc..5d7c7a2c2 100644 --- a/source/net/yacy/cora/lod/vocabulary/Tagging.java +++ b/source/net/yacy/cora/lod/vocabulary/Tagging.java @@ -42,6 +42,7 @@ import net.yacy.cora.geo.Locations; import net.yacy.cora.storage.Files; import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.ConcurrentLog; +import net.yacy.search.Switchboard; public class Tagging { @@ -212,7 +213,6 @@ public class Tagging { String[] tags; int p; String line; - Pattern kommapattern = Pattern.compile(","); try { String[] pl; vocloop: while ((line = list.take()) != Files.POISON_LINE) { @@ -245,7 +245,7 @@ public class Tagging { } term = normalizeKey(pl[0]); v = pl[1]; - tags = kommapattern.split(v); + tags = CommonPattern.COMMA.split(v); Set synonyms = new HashSet(); synonyms.add(term); tagloop: for (String synonym: tags) { @@ -278,6 +278,8 @@ public class Tagging { public void setFacet(boolean isFacet) { this.isFacet = isFacet; + String omit = Switchboard.getSwitchboard().getConfig("search.result.show.vocabulary.omit", ""); + } public int size() { @@ -551,7 +553,6 @@ public class Tagging { private final static Pattern PATTERN_OE = Pattern.compile("\u00F6"); private final static Pattern PATTERN_UE = Pattern.compile("\u00FC"); private final static Pattern PATTERN_SZ = Pattern.compile("\u00DF"); - private final static Pattern PATTERN_COMMA = Pattern.compile(","); public static final String normalizeTerm(String term) { term = term.trim().toLowerCase(); @@ -559,7 +560,7 @@ public class Tagging { term = PATTERN_OE.matcher(term).replaceAll("oe"); term = PATTERN_UE.matcher(term).replaceAll("ue"); term = PATTERN_SZ.matcher(term).replaceAll("ss"); - term = PATTERN_COMMA.matcher(term).replaceAll(" "); + term = CommonPattern.COMMA.matcher(term).replaceAll(" "); return term; } diff --git a/source/net/yacy/data/ListManager.java b/source/net/yacy/data/ListManager.java index 30c2ceb58..b6ebb26da 100644 --- a/source/net/yacy/data/ListManager.java +++ b/source/net/yacy/data/ListManager.java @@ -35,6 +35,7 @@ import java.util.Set; import java.util.Vector; import java.util.regex.Pattern; +import net.yacy.cora.util.CommonPattern; import net.yacy.kelondro.util.FileUtils; import net.yacy.repository.Blacklist.BlacklistType; import net.yacy.repository.BlacklistFile; @@ -45,8 +46,6 @@ import net.yacy.search.query.SearchEventCache; public class ListManager { - private final static Pattern commaPattern = Pattern.compile(","); - public static Switchboard switchboard = null; public static File listsPath = null; @@ -147,7 +146,7 @@ public class ListManager { ArrayList list; if (string != null && string.length() > 0) { - list = new ArrayList(Arrays.asList(commaPattern.split(string, 0))); + list = new ArrayList(Arrays.asList(CommonPattern.COMMA.split(string, 0))); } else { list = new ArrayList(); } @@ -165,7 +164,7 @@ public class ListManager { HashSet set; if (string != null) { - set = new HashSet(Arrays.asList(commaPattern.split(string, 0))); + set = new HashSet(Arrays.asList(CommonPattern.COMMA.split(string, 0))); } else { set = new HashSet(); } @@ -184,7 +183,7 @@ public class ListManager { Vector v; if (string != null) { - v = new Vector(Arrays.asList(commaPattern.split(string, 0))); + v = new Vector(Arrays.asList(CommonPattern.COMMA.split(string, 0))); } else { v = new Vector(); } diff --git a/source/net/yacy/kelondro/index/Row.java b/source/net/yacy/kelondro/index/Row.java index 85240805c..4688461fc 100644 --- a/source/net/yacy/kelondro/index/Row.java +++ b/source/net/yacy/kelondro/index/Row.java @@ -53,7 +53,6 @@ import net.yacy.kelondro.util.kelondroException; public final class Row implements Serializable { - //private final static Pattern commaPattern = Pattern.compile(","); private static final long serialVersionUID=-148412365988669116L; protected final Column[] row;