Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix 'documentation' mapping
This fix will change the 'documentation' mapping from:

    "documentation" : {
          "type" : "string"
    }

to:
    "documentation" : {
        "fields" : {
           "camelcase" : {
              "store" : true,
              "analyzer" : "camelcase",
              "type" : "string"
           },
           "lowercase" : {
              "analyzer" : "lowercase",
              "type" : "string",
              "store" : true
           },
           "edge" : {
              "analyzer" : "edge",
              "type" : "string",
              "store" : true
           },
           "analyzed" : {
              "analyzer" : "standard",
              "type" : "string",
              "fielddata" : {
                 "format" : "disabled"
              },
              "store" : true
           },
           "edge_camelcase" : {
              "store" : true,
              "type" : "string",
              "analyzer" : "edge_camelcase"
           }
        },
        "ignore_above" : 2048,
        "index" : "not_analyzed",
        "type" : "string"
     }

This change will also restore the original behavior of `autocomplete`
and fix the test t/server/controller/search/autocomplete.t
It is also needed to fix a test in the metacpan-web repo.
  • Loading branch information
mickeyn committed May 20, 2016
1 parent 4aa8361 commit c6d204d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions lib/MetaCPAN/Document/File.pm
Expand Up @@ -294,11 +294,12 @@ set to C<undef>.
=cut

has documentation => (
is => 'ro',
isa => Maybe [Str],
is => 'ro',

# isa => Maybe [Str],

This comment has been minimized.

Copy link
@oalders

oalders May 20, 2016

Member

What's the reason for dropping isa?

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 c6d204d

Please sign in to comment.