Skip to content

Instantly share code, notes, and snippets.

Created Aug 29, 2012
What would you like to do?
Fix single colon in search queries
--- a/lib/MetaCPAN/Web/Controller/
+++ b/lib/MetaCPAN/Web/Controller/
@@ -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} ) {
Copy link

grantm commented Aug 29, 2012

This is meant to be a fix for the problem described here: (i.e. the search query used a single ':' instead of '::')

Not sure is it has undesirable side-effects.

Are there legitimate reasons to use a single colon in a search like "word1:word2" ?

Is it a step too far to change apostrophes so that "don't" gets turned into "don::t" ?

Copy link

grantm commented Aug 29, 2012

s/Not sure is/Not sure if/

Copy link

monken commented Aug 30, 2012

yes, we have the dist:Moose syntax and more (author:PERLER, etc.)
This is lucene search syntax.

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