diff --git a/lib/MetaCPAN/Document/File.pm b/lib/MetaCPAN/Document/File.pm index 464c3e024..07bdc474a 100644 --- a/lib/MetaCPAN/Document/File.pm +++ b/lib/MetaCPAN/Document/File.pm @@ -73,7 +73,10 @@ sub _build_section { has abstract => ( is => 'ro', - # isa => Maybe[Str], + # isa is commented as it affect the type mapping + # see https://github.com/CPAN-API/cpan-api/pull/484 + # -- Mickey + # isa => Maybe[Str], lazy => 1, builder => '_build_abstract', index => 'analyzed', @@ -294,11 +297,15 @@ set to C. =cut has documentation => ( - is => 'ro', - isa => Maybe [Str], + is => 'ro', + + # isa is commented as it affect the type mapping + # see https://github.com/CPAN-API/cpan-api/pull/484 + # -- Mickey + # isa => Maybe [Str], lazy => 1, - builder => '_build_documentation', index => 'analyzed', + builder => '_build_documentation', predicate => 'has_documentation', analyzer => [qw(standard camelcase lowercase edge edge_camelcase)], clearer => 'clear_documentation', diff --git a/lib/MetaCPAN/Document/File/Set.pm b/lib/MetaCPAN/Document/File/Set.pm index d5d5ac480..c25caac93 100644 --- a/lib/MetaCPAN/Document/File/Set.pm +++ b/lib/MetaCPAN/Document/File/Set.pm @@ -388,7 +388,7 @@ sub autocomplete { } } } - )->sort( [ '_score', 'module.name.lowercase' ] ); + )->sort( [ '_score', 'documentation' ] ); } __PACKAGE__->meta->make_immutable; diff --git a/t/server/controller/search/autocomplete.t b/t/server/controller/search/autocomplete.t index a0694e65a..ce464ad83 100644 --- a/t/server/controller/search/autocomplete.t +++ b/t/server/controller/search/autocomplete.t @@ -23,9 +23,9 @@ test_psgi app, sub { Multiple::Modules::A Multiple::Modules::B Multiple::Modules::RDeps + Multiple::Modules::Tester Multiple::Modules::RDeps::A Multiple::Modules::RDeps::Deprecated - Multiple::Modules::Tester ) ], 'results are sorted lexically by module name + length'