Skip to content

Instantly share code, notes, and snippets.

@grantm
Created August 29, 2012 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantm/3520281 to your computer and use it in GitHub Desktop.
Save grantm/3520281 to your computer and use it in GitHub Desktop.
Fix single colon in search queries
--- a/lib/MetaCPAN/Web/Controller/Search.pm
+++ b/lib/MetaCPAN/Web/Controller/Search.pm
@@ -22,6 +22,9 @@ sub index : Path {
$query =~ s{\.pm\b}{};
}
+ # normalise ":", "'" and "-" separators to "::"
+ $query =~ s{\b[:'-]\b}{::}g;
+
my $model = $c->model('API::Module');
my $from = ( $req->page - 1 ) * 20;
if ( $req->parameters->{lucky} ) {
@dpetrov
Copy link

dpetrov commented Aug 31, 2012

let just exclude those like dist:, file:, module:, author:?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment