refactoring with CommonPattern.COMMA

pull/1/head
Michael Peter Christen 10 years ago
parent cf9b22ca5c
commit ac19690d30

@ -830,6 +830,7 @@ search.result.show.cache = true
search.result.show.proxy = false search.result.show.proxy = false
search.result.show.hostbrowser = true search.result.show.hostbrowser = true
search.result.show.vocabulary = false search.result.show.vocabulary = false
search.result.show.vocabulary.omit =
# search navigators: comma-separated list of default values for search navigation. # search navigators: comma-separated list of default values for search navigation.

@ -42,6 +42,7 @@ import net.yacy.cora.geo.Locations;
import net.yacy.cora.storage.Files; import net.yacy.cora.storage.Files;
import net.yacy.cora.util.CommonPattern; import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog; import net.yacy.cora.util.ConcurrentLog;
import net.yacy.search.Switchboard;
public class Tagging { public class Tagging {
@ -212,7 +213,6 @@ public class Tagging {
String[] tags; String[] tags;
int p; int p;
String line; String line;
Pattern kommapattern = Pattern.compile(",");
try { try {
String[] pl; String[] pl;
vocloop: while ((line = list.take()) != Files.POISON_LINE) { vocloop: while ((line = list.take()) != Files.POISON_LINE) {
@ -245,7 +245,7 @@ public class Tagging {
} }
term = normalizeKey(pl[0]); term = normalizeKey(pl[0]);
v = pl[1]; v = pl[1];
tags = kommapattern.split(v); tags = CommonPattern.COMMA.split(v);
Set<String> synonyms = new HashSet<String>(); Set<String> synonyms = new HashSet<String>();
synonyms.add(term); synonyms.add(term);
tagloop: for (String synonym: tags) { tagloop: for (String synonym: tags) {
@ -278,6 +278,8 @@ public class Tagging {
public void setFacet(boolean isFacet) { public void setFacet(boolean isFacet) {
this.isFacet = isFacet; this.isFacet = isFacet;
String omit = Switchboard.getSwitchboard().getConfig("search.result.show.vocabulary.omit", "");
} }
public int size() { public int size() {
@ -551,7 +553,6 @@ public class Tagging {
private final static Pattern PATTERN_OE = Pattern.compile("\u00F6"); private final static Pattern PATTERN_OE = Pattern.compile("\u00F6");
private final static Pattern PATTERN_UE = Pattern.compile("\u00FC"); private final static Pattern PATTERN_UE = Pattern.compile("\u00FC");
private final static Pattern PATTERN_SZ = Pattern.compile("\u00DF"); private final static Pattern PATTERN_SZ = Pattern.compile("\u00DF");
private final static Pattern PATTERN_COMMA = Pattern.compile(",");
public static final String normalizeTerm(String term) { public static final String normalizeTerm(String term) {
term = term.trim().toLowerCase(); term = term.trim().toLowerCase();
@ -559,7 +560,7 @@ public class Tagging {
term = PATTERN_OE.matcher(term).replaceAll("oe"); term = PATTERN_OE.matcher(term).replaceAll("oe");
term = PATTERN_UE.matcher(term).replaceAll("ue"); term = PATTERN_UE.matcher(term).replaceAll("ue");
term = PATTERN_SZ.matcher(term).replaceAll("ss"); term = PATTERN_SZ.matcher(term).replaceAll("ss");
term = PATTERN_COMMA.matcher(term).replaceAll(" "); term = CommonPattern.COMMA.matcher(term).replaceAll(" ");
return term; return term;
} }

@ -35,6 +35,7 @@ import java.util.Set;
import java.util.Vector; import java.util.Vector;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.yacy.cora.util.CommonPattern;
import net.yacy.kelondro.util.FileUtils; import net.yacy.kelondro.util.FileUtils;
import net.yacy.repository.Blacklist.BlacklistType; import net.yacy.repository.Blacklist.BlacklistType;
import net.yacy.repository.BlacklistFile; import net.yacy.repository.BlacklistFile;
@ -45,8 +46,6 @@ import net.yacy.search.query.SearchEventCache;
public class ListManager { public class ListManager {
private final static Pattern commaPattern = Pattern.compile(",");
public static Switchboard switchboard = null; public static Switchboard switchboard = null;
public static File listsPath = null; public static File listsPath = null;
@ -147,7 +146,7 @@ public class ListManager {
ArrayList<String> list; ArrayList<String> list;
if (string != null && string.length() > 0) { if (string != null && string.length() > 0) {
list = new ArrayList<String>(Arrays.asList(commaPattern.split(string, 0))); list = new ArrayList<String>(Arrays.asList(CommonPattern.COMMA.split(string, 0)));
} else { } else {
list = new ArrayList<String>(); list = new ArrayList<String>();
} }
@ -165,7 +164,7 @@ public class ListManager {
HashSet<String> set; HashSet<String> set;
if (string != null) { if (string != null) {
set = new HashSet<String>(Arrays.asList(commaPattern.split(string, 0))); set = new HashSet<String>(Arrays.asList(CommonPattern.COMMA.split(string, 0)));
} else { } else {
set = new HashSet<String>(); set = new HashSet<String>();
} }
@ -184,7 +183,7 @@ public class ListManager {
Vector<String> v; Vector<String> v;
if (string != null) { if (string != null) {
v = new Vector<String>(Arrays.asList(commaPattern.split(string, 0))); v = new Vector<String>(Arrays.asList(CommonPattern.COMMA.split(string, 0)));
} else { } else {
v = new Vector<String>(); v = new Vector<String>();
} }

@ -53,7 +53,6 @@ import net.yacy.kelondro.util.kelondroException;
public final class Row implements Serializable { public final class Row implements Serializable {
//private final static Pattern commaPattern = Pattern.compile(",");
private static final long serialVersionUID=-148412365988669116L; private static final long serialVersionUID=-148412365988669116L;
protected final Column[] row; protected final Column[] row;

Loading…
Cancel
Save