From 9c26c01867ca3e2af1e70c051140eea59c68c500 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 7 Mar 2017 17:47:36 -0500 Subject: Bug 1307485 - Add code to run a subset of buglist.cgi search queries against the ES backend --- Bugzilla/Bug.pm | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) (limited to 'Bugzilla/Bug.pm') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index cba973863..bc099f76e 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -303,19 +303,15 @@ with 'Bugzilla::Elastic::Role::Object'; sub ES_TYPE {'bug'} sub _bz_field { - my ($field, $type, $analyzer, @fields) = @_; + my ($field, @fields) = @_; return ( $field => { - type => $type, - analyzer => $analyzer, + type => 'string', + analyzer => 'bz_text_analyzer', fields => { - raw => { - type => 'string', - index => 'not_analyzed', - }, eq => { - type => 'string', + type => 'string', analyzer => 'bz_equals_analyzer', }, @fields, @@ -324,32 +320,20 @@ sub _bz_field { ); } -sub _bz_text_field { - my ($field) = @_; - - return _bz_field($field, 'string', 'bz_text_analyzer'); -} - -sub _bz_substring_field { - my ($field, @rest) = @_; - - return _bz_field($field, 'string', 'bz_substring_analyzer', @rest); -} - sub ES_PROPERTIES { return { - priority => { type => 'string', analyzer => 'keyword' }, - bug_severity => { type => 'string', analyzer => 'keyword' }, - bug_status => { type => 'string', analyzer => 'keyword' }, - resolution => { type => 'string', analyzer => 'keyword' }, - keywords => { type => 'string' }, + _bz_field('priority'), + _bz_field('bug_severity'), + _bz_field('bug_status'), + _bz_field('resolution'), status_whiteboard => { type => 'string', analyzer => 'whiteboard_shingle_tokens' }, delta_ts => { type => 'string', index => 'not_analyzed' }, - _bz_substring_field('product'), - _bz_substring_field('component'), - _bz_substring_field('classification'), - _bz_text_field('short_desc'), - _bz_substring_field('assigned_to'), + _bz_field('product'), + _bz_field('component'), + _bz_field('classification'), + _bz_field('short_desc'), + _bz_field('assigned_to'), + _bz_field('reporter'), }; } @@ -426,7 +410,7 @@ sub es_document { bug_id => $self->id, product => $self->product_obj->name, alias => $self->alias, - keywords => $self->keywords, + keywords => [ map { $_->name } @{$self->keyword_objects} ], priority => $self->priority, bug_status => $self->bug_status, resolution => $self->resolution, @@ -435,6 +419,7 @@ sub es_document { status_whiteboard => $self->status_whiteboard, short_desc => $self->short_desc, assigned_to => $self->assigned_to->login, + reporter => $self->reporter->login, delta_ts => $self->delta_ts, bug_severity => $self->bug_severity, }; -- cgit v1.2.3-24-g4f1b