diff options
author | Dylan William Hardison <dylan@hardison.net> | 2017-03-21 04:08:26 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2017-03-21 04:08:26 +0100 |
commit | b921e3142e37977298571a4229faca4e1794017d (patch) | |
tree | c965352b0db57f0d73f12ba2fd818845566dbe8b /Bugzilla/Elastic.pm | |
parent | e53de8c34e12e18ecea98ad97775893f083beff7 (diff) | |
download | bugzilla-b921e3142e37977298571a4229faca4e1794017d.tar.gz bugzilla-b921e3142e37977298571a4229faca4e1794017d.tar.xz |
Bug 1307485 - Add code to run a subset of buglist.cgi search queries against the ES backend
Skipping this for this week's push.
Diffstat (limited to 'Bugzilla/Elastic.pm')
-rw-r--r-- | Bugzilla/Elastic.pm | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/Bugzilla/Elastic.pm b/Bugzilla/Elastic.pm deleted file mode 100644 index 6384269fd..000000000 --- a/Bugzilla/Elastic.pm +++ /dev/null @@ -1,47 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This Source Code Form is "Incompatible With Secondary Licenses", as -# defined by the Mozilla Public License, v. 2.0. -package Bugzilla::Elastic; -use 5.10.1; -use Moo; - -use Bugzilla::Elastic::Search; -use Bugzilla::Util qw(trick_taint); - -with 'Bugzilla::Elastic::Role::HasClient'; -with 'Bugzilla::Elastic::Role::HasIndexName'; - -sub suggest_users { - my ($self, $text) = @_; - my $field = 'suggest_user'; - if ($text =~ /^:(.+)$/) { - $text = $1; - $field = 'suggest_nick'; - } - - my $result = eval { - $self->client->suggest( - index => $self->index_name, - body => { - $field => { - text => $text, - completion => { field => $field, size => 25 }, - } - } - ); - }; - if (defined $result) { - return [ map { $_->{payload} } @{$result->{$field}[0]{options}} ]; - } - else { - warn "suggest_users error: $@"; - my $users = Bugzilla::User::match($text, 25, 0); - return [ map { { real_name => $_->name, name => $_->login } } @$users]; - } -} - - -1; |