Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #484 from CPAN-API/mickey/fix_documentation_mapping
Browse files Browse the repository at this point in the history
Fix 'documentation' mapping
  • Loading branch information
oalders committed May 20, 2016
2 parents 4aa8361 + 3350fe3 commit 3a5c168
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -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',
Expand Down Expand Up @@ -294,11 +297,15 @@ set to C<undef>.
=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',
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Document/File/Set.pm
Expand Up @@ -388,7 +388,7 @@ sub autocomplete {
}
}
}
)->sort( [ '_score', 'module.name.lowercase' ] );
)->sort( [ '_score', 'documentation' ] );
}

__PACKAGE__->meta->make_immutable;
Expand Down
2 changes: 1 addition & 1 deletion t/server/controller/search/autocomplete.t
Expand Up @@ -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'
Expand Down

0 comments on commit 3a5c168

Please sign in to comment.