Skip to content

Commit

Permalink
Merge pull request #956 from metacpan/oalders/colon
Browse files Browse the repository at this point in the history
Fix author/dist/module searches
  • Loading branch information
ssoriche committed Apr 18, 2020
2 parents 0b029ef + 96905c8 commit 3d01fa5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/MetaCPAN/Model/Search.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ sub search_web {
$from //= 0;

$search_term
=~ s{([ + - = > < ! & | ( ) { } \[ \] ^ " ~ * ? : \ / ])}{\\$1}x;
=~ s{([ + - = > < ! & | ( ) { } \[ \] ^ " ~ * ? \ / ])}{\\$1}x;

# munge the search_term
# these would be nicer if we had variable-length lookbehinds...
# Allow q = 'author:LLAP' or 'module:Data::Page' or 'dist:'
# We are mapping to correct ES fields here - wonder if ANYONE
# uses these?!?!?!
#
# The exceptions below are used specifically by the front end search.
# We've temporarily removed the ":" from the regex above so that the the
# author/dist/module searches work again. The were broken in 225749b6e.
$search_term #
=~ s{(^|\s)author:([a-zA-Z]+)(?=\s|$)}{$1author:\U$2\E}g;
$search_term
Expand Down

0 comments on commit 3d01fa5

Please sign in to comment.