Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-706 Url regex normalizer: pattern for session id removal not to match "newsId"

Sebastian Nagelddca587784eb
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c09be14f..fef8aeceb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
(trunk) Current Development:
+* NUTCH-706 Url regex normalizer: pattern for session id removal not to match "newsId" (Meghna Kukreja via snagel)
+
* NUTCH-1415 release packages to contain top level folder apache-nutch-x.x (snagel)
* NUTCH-1441 AnchorIndexingFilter should use plain HashSet (ferdy via lewismc)
diff --git a/conf/regex-normalize.xml.template b/conf/regex-normalize.xml.template
index 95f755767..4bc1611a6 100644
--- a/conf/regex-normalize.xml.template
+++ b/conf/regex-normalize.xml.template
@@ -29,7 +29,7 @@
<!-- removes session ids from urls (such as jsessionid and PHPSESSID) -->
<regex>
- <pattern>([;_]?((?i)l|j|bv_)?((?i)sid|phpsessid|sessionid)=.*?)(\?|&amp;|#|$)</pattern>
+ <pattern>([;_]?\b((?i)l|j|bv_)?((?i)sid|phpsessid|sessionid)=.*?)(\?|&amp;|#|$)</pattern>
<substitution>$4</substitution>
</regex>
diff --git a/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.test b/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.test
index 54e392c15..09fb9188c 100644
--- a/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.test
+++ b/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.test
@@ -11,6 +11,8 @@ http://www.foo.com/foo.html;jsessionid=1E6FEC0D14D044541DD84D2D013D29ED http://w
http://www.foo.com/foo.html?param=1&another=2;jsessionid=1E6FEC0D14D044541DD84D2D013D29ED http://www.foo.com/foo.html?param=1&another=2
http://www.foo.com/foo.html;jsessionid=1E6FEC0D14D044541DD84D2D013D29ED?param=1&another=2 http://www.foo.com/foo.html?param=1&another=2
http://www.foo.com/foo.php?&x=1&sid=xyz&something=1 http://www.foo.com/foo.php?x=1&something=1
+# but NewsId is not a session id (NUTCH-706, NUTCH-1328)
+http://www.foo.com/fa/newsdetail.aspx?NewsID=1567539 http://www.foo.com/fa/newsdetail.aspx?NewsID=1567539
# test removal default pages
http://www.foo.com/home/index.html http://www.foo.com/home/
diff --git a/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.xml b/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.xml
index 8c68b5095..14e2b4fb8 100644
--- a/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.xml
+++ b/src/plugin/urlnormalizer-regex/sample/regex-normalize-default.xml
@@ -13,7 +13,7 @@
<!-- removes session ids from urls (such as jsessionid and PHPSESSID) -->
<regex>
- <pattern>([;_]?((?i)l|j|bv_)?((?i)sid|phpsessid|sessionid)=.*?)(\?|&amp;|#|$)</pattern>
+ <pattern>([;_]?\b((?i)l|j|bv_)?((?i)sid|phpsessid|sessionid)=.*?)(\?|&amp;|#|$)</pattern>
<substitution>$4</substitution>
</regex>