Skip to content

Commit 9d7af29

Browse files
authored
Merge pull request #1206 from metacpan/haarg/index-documentation-length
index module name length as separate field
2 parents 9e21623 + efddf49 commit 9d7af29

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

lib/MetaCPAN/Document/File.pm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,18 @@ sub _build_documentation {
378378
return undef;
379379
}
380380

381+
has documentation_length => (
382+
is => 'ro',
383+
isa => Maybe [Int],
384+
lazy => 1,
385+
builder => '_build_documentation_length',
386+
);
387+
388+
sub _build_documentation_length {
389+
my ($self) = @_;
390+
return length( $self->documentation );
391+
}
392+
381393
=head2 suggest
382394
383395
Autocomplete info for documentation.

lib/MetaCPAN/Script/Mapping/CPAN/File.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ sub mapping {
116116
},
117117
"ignore_above" : 2048
118118
},
119+
"documentation_length" : {
120+
"type" : "integer"
121+
},
119122
"download_url" : {
120123
"type" : "string",
121124
"index" : "not_analyzed",

lib/MetaCPAN/Script/Release.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ sub import_archive {
347347

348348
$file->clear_module if ( $file->is_pod_file );
349349
$file->documentation;
350+
$file->documentation_length;
350351
$file->suggest;
351352

352353
log_trace {"reindexing file $file->{path}"};

t/document/file.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ END
9696

9797
my $file = new_file_doc( content => \$content );
9898

99-
is( $file->abstract, 'mymodule1 abstract' );
100-
is( $file->documentation, 'MyModule' );
99+
is( $file->abstract, 'mymodule1 abstract' );
100+
is( $file->documentation, 'MyModule' );
101+
is( $file->documentation_length, 8 );
101102
is_deeply( $file->pod_lines, [ [ 3, 12 ], [ 18, 6 ] ] );
102103
is( $file->sloc, 3 );
103104
is( $file->slop, 11 );

0 commit comments

Comments
 (0)