summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-03-17 21:53:57 +0100
committerDylan William Hardison <dylan@hardison.net>2017-03-17 21:53:57 +0100
commit1ad85fd04a2268a660fbf35068e730dda917d137 (patch)
tree3155f5d6d82532810cb653fa04b7e466199f7e71 /scripts
parent4cc54c4c9acd39b1b0850c9d5a937f5f909d18d0 (diff)
downloadbugzilla-1ad85fd04a2268a660fbf35068e730dda917d137.tar.gz
bugzilla-1ad85fd04a2268a660fbf35068e730dda917d137.tar.xz
Bug 1307485 - Add code to run a subset of buglist.cgi search queries against the ES backend
This not the cause of test failures, so should live on in master now.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/search.pl13
-rw-r--r--scripts/suggest-user.pl20
2 files changed, 33 insertions, 0 deletions
diff --git a/scripts/search.pl b/scripts/search.pl
new file mode 100644
index 000000000..6e0f7245d
--- /dev/null
+++ b/scripts/search.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Bugzilla;
+use JSON '-convert_blessed_universally';
+
+print JSON->new->pretty->encode(
+ Bugzilla::Elastic::Search->new(
+ quicksearch => "@ARGV",
+ fields => ['bug_id', 'short_desc'],
+ order => ['bug_id'],
+ )->es_query
+);
diff --git a/scripts/suggest-user.pl b/scripts/suggest-user.pl
new file mode 100644
index 000000000..dcf24da87
--- /dev/null
+++ b/scripts/suggest-user.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use FindBin qw($RealBin);
+use lib ($RealBin);
+use Bugzilla;
+use Search::Elasticsearch;
+use Bugzilla::Elastic;
+
+my $elastic = Bugzilla::Elastic->new(
+ es_client => Search::Elasticsearch->new()
+);
+my $user = Bugzilla::User->check({name => 'dylan@mozilla.com'});
+Bugzilla->set_user($user);
+my $users;
+
+for (1..4) {
+ $users = $elastic->suggest_users($ARGV[0]);
+}
+print "$_->{name}\n" for @$users;