File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -79,18 +79,15 @@ sub search_web {
79
79
$page_size //= 20;
80
80
$from //= 0;
81
81
82
- $search_term
83
- =~ s { ([ + - = > < ! & | ( ) { } \[ \] ^ " ~ * ? \ / ])} { \\ $1 } x ;
82
+ $search_term =~ s { ([+=><!&|\(\)\{\} [\]\^ "~*?\\ /])} { \\ $1 } g ;
84
83
85
84
# munge the search_term
86
85
# these would be nicer if we had variable-length lookbehinds...
87
86
# Allow q = 'author:LLAP' or 'module:Data::Page' or 'dist:'
88
- # We are mapping to correct ES fields here - wonder if ANYONE
89
- # uses these?!?!?!
87
+ # We are mapping to correct ES fields here - relied on by metacpan-web
88
+ # tests.
90
89
#
91
90
# The exceptions below are used specifically by the front end search.
92
- # We've temporarily removed the ":" from the regex above so that the the
93
- # author/dist/module searches work again. The were broken in 225749b6e.
94
91
$search_term #
95
92
=~ s { (^|\s )author:([a-zA-Z]+)(?=\s |$)} { $1author:\U $2 \E } g ;
96
93
$search_term
Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ ok( $search->_not_rogue, '_not_rogue' );
59
59
is( @{ $results -> {results } }, 5, ' 5 results on author search' );
60
60
}
61
61
62
+ {
63
+ my $results = $search -> search_web(' author:Mo BadPod' );
64
+ isnt( @{ $results -> {results } },
65
+ 0, ' >0 results on author search with extra' );
66
+ }
67
+
68
+ {
69
+ eval { $search -> search_web(' usr/bin/env' ) };
70
+ is( $@ , ' ' , ' search term with a / no exception' );
71
+ }
72
+
62
73
{
63
74
my $long_form = $search -> search_web(' distribution:Pod-Pm' );
64
75
my $short_form = $search -> search_web(' dist:Pod-Pm' );
You can’t perform that action at this time.
0 commit comments