summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-18 00:20:01 +0200
committerGitHub <noreply@github.com>2017-07-18 00:20:01 +0200
commitffcb4cd902f9babafa1634e43ebee8175d073099 (patch)
treee7ad279fceef60aad7b950da8210b75f8e4231b9 /Bugzilla
parente203bc3af47406339870e718475f0f0ea194f6c9 (diff)
downloadbugzilla-ffcb4cd902f9babafa1634e43ebee8175d073099.tar.gz
bugzilla-ffcb4cd902f9babafa1634e43ebee8175d073099.tar.xz
Bug 1380408 - elasticsearch user completion should consider people with multiple ircnicks
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Elastic/Indexer.pm1
-rw-r--r--Bugzilla/User.pm16
2 files changed, 10 insertions, 7 deletions
diff --git a/Bugzilla/Elastic/Indexer.pm b/Bugzilla/Elastic/Indexer.pm
index ab6c5dbfa..46eb8f648 100644
--- a/Bugzilla/Elastic/Indexer.pm
+++ b/Bugzilla/Elastic/Indexer.pm
@@ -184,6 +184,7 @@ sub bulk_load {
my $new_ids = $self->_select_all_ids($class, $last_id);
my $updated_ids = $self->_select_updated_ids($class, $last_mtime);
+ $self->put_mapping($class);
$self->_bulk_load_ids($bulk, $class, $new_ids) if @$new_ids;
$self->_bulk_load_ids($bulk, $class, $updated_ids) if @$updated_ids;
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index a3a78395a..2d7f38640 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -175,21 +175,23 @@ sub ES_PROPERTIES {
sub es_document {
my ( $self, $timestamp ) = @_;
my $doc = {
- login => $self->login,
- name => $self->name,
- is_enabled => $self->is_enabled,
+ login => $self->login,
+ name => $self->name,
+ is_enabled => $self->is_enabled,
suggest_user => {
input => [ $self->login, $self->name ],
output => $self->identity,
payload => { name => $self->login, real_name => $self->name },
},
};
- if ($self->name && $self->name =~ /:(\w+)/) {
- my $ircnick = $1;
+ my $name = $self->name;
+ my @nicks = defined($name) ? ( $name =~ /:(\w+)\b/mg ) : ();
+
+ if (@nicks) {
$doc->{suggest_nick} = {
- input => [ $ircnick ],
+ input => \@nicks,
output => $self->login,
- payload => { name => $self->login, real_name => $self->name, ircnick => $ircnick },
+ payload => { name => $self->login, real_name => $self->name },
};
}