From cd14e7fbcafcf124a7c059fa518f5e5fc7409e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Thu, 5 Sep 2013 13:42:46 -0700 Subject: [PATCH] fix regex and assign random user ids --- .../metamx/druid/realtime/firehose/IrcFirehoseFactory.java | 7 ++++--- .../druid/realtime/firehose/WikipediaIrcDecoder.java | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/realtime/src/main/java/com/metamx/druid/realtime/firehose/IrcFirehoseFactory.java b/realtime/src/main/java/com/metamx/druid/realtime/firehose/IrcFirehoseFactory.java index 5e3efa7af4e..b2bdab66e1d 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/firehose/IrcFirehoseFactory.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/firehose/IrcFirehoseFactory.java @@ -38,6 +38,7 @@ import org.joda.time.DateTime; import java.io.File; import java.io.IOException; import java.util.List; +import java.util.UUID; import java.util.concurrent.LinkedBlockingQueue; /** @@ -146,9 +147,9 @@ public class IrcFirehoseFactory implements FirehoseFactory @Override public List getAlternativeNicknames() { - return Lists.newArrayList(nick + "_", - nick + "__", - nick + "___"); + return Lists.newArrayList(nick + UUID.randomUUID(), + nick + UUID.randomUUID(), + nick + UUID.randomUUID()); } @Override diff --git a/realtime/src/main/java/com/metamx/druid/realtime/firehose/WikipediaIrcDecoder.java b/realtime/src/main/java/com/metamx/druid/realtime/firehose/WikipediaIrcDecoder.java index fc45f5f4e91..262be0c93df 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/firehose/WikipediaIrcDecoder.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/firehose/WikipediaIrcDecoder.java @@ -50,8 +50,10 @@ class WikipediaIrcDecoder implements IrcDecoder final DatabaseReader geoLookup; static final Pattern pattern = Pattern.compile( - "\\x0314\\[\\[\\x0307(.+?)\\x0314\\]\\]\\x034 (.*?)\\x0310.*\\x0302(http.+?)\\x03.+\\x0303(.+?)\\x03.+\\x03 (\\(([+-]\\d+)\\).*|.+) \\x0310(.+)\\x03" + ".*\\x0314\\[\\[\\x0307(.+?)\\x0314\\]\\]\\x034 (.*?)\\x0310.*\\x0302(http.+?)" + + "\\x03.+\\x0303(.+?)\\x03.+\\x03 (\\(([+-]\\d+)\\).*|.+) \\x0310(.+)\\x03.*" ); + static final Pattern ipPattern = Pattern.compile("\\d+.\\d+.\\d+.\\d+"); static final Pattern shortnamePattern = Pattern.compile("#(\\w\\w)\\..*");