Created
August 29, 2012 23:23
-
-
Save grantm/3520281 to your computer and use it in GitHub Desktop.
Fix single colon in search queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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} ) { |
s/Not sure is/Not sure if/
yes, we have the dist:Moose syntax and more (author:PERLER, etc.)
This is lucene search syntax.
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
This is meant to be a fix for the problem described here: http://blog.afoolishmanifesto.com/archives/1692 (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" ?