diff --git a/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb b/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb index ec39134c225..52e011e261d 100644 --- a/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +++ b/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb @@ -6,12 +6,14 @@ class Api::V2::ContentViewFilterRulesController < Api::V2::ApiController api :GET, "/content_view_filters/:content_view_filter_id/rules", N_("List filter rules") param :content_view_filter_id, :identifier, :desc => N_("filter identifier"), :required => true def index - options = sort_params - options[:load_records?] = true - options[:filters] = [{ :terms => { :id => ContentViewFilter.rule_ids_for(@filter) } }] - - @search_service.model = ContentViewFilter.rule_class_for(@filter) - respond(:collection => item_search(ContentViewFilter.rule_class_for(@filter), params, options)) + ids = ContentViewFilter.rule_ids_for(@filter) + results = ids.map { |id| ContentViewFilter.rule_class_for(@filter).find(id) } + collection = { + :results => results.uniq, + :subtotal => results.count, + :total => results.count + } + respond :collection => collection end api :POST, "/content_view_filters/:content_view_filter_id/rules", diff --git a/app/models/katello/content_view_erratum_filter_rule.rb b/app/models/katello/content_view_erratum_filter_rule.rb index c81827743ad..df6bb04cad3 100644 --- a/app/models/katello/content_view_erratum_filter_rule.rb +++ b/app/models/katello/content_view_erratum_filter_rule.rb @@ -2,8 +2,6 @@ module Katello class ContentViewErratumFilterRule < Katello::Model self.include_root_in_json = false - include Glue::ElasticSearch::ContentViewErratumFilterRule if SETTINGS[:katello][:use_elasticsearch] - belongs_to :filter, :class_name => "Katello::ContentViewErratumFilter", :inverse_of => :erratum_rules, diff --git a/app/models/katello/content_view_package_filter_rule.rb b/app/models/katello/content_view_package_filter_rule.rb index eaff5716d9a..fa22494077e 100644 --- a/app/models/katello/content_view_package_filter_rule.rb +++ b/app/models/katello/content_view_package_filter_rule.rb @@ -2,8 +2,6 @@ module Katello class ContentViewPackageFilterRule < Katello::Model self.include_root_in_json = false - include Glue::ElasticSearch::ContentViewPackageFilterRule if SETTINGS[:katello][:use_elasticsearch] - belongs_to :filter, :class_name => "Katello::ContentViewPackageFilter", :inverse_of => :package_rules, diff --git a/app/models/katello/content_view_package_group_filter_rule.rb b/app/models/katello/content_view_package_group_filter_rule.rb index b10986c9fbc..3205eccb105 100644 --- a/app/models/katello/content_view_package_group_filter_rule.rb +++ b/app/models/katello/content_view_package_group_filter_rule.rb @@ -2,8 +2,6 @@ module Katello class ContentViewPackageGroupFilterRule < Katello::Model self.include_root_in_json = false - include Glue::ElasticSearch::ContentViewPackageGroupFilterRule if SETTINGS[:katello][:use_elasticsearch] - belongs_to :filter, :class_name => "Katello::ContentViewPackageGroupFilter", :inverse_of => :package_group_rules, diff --git a/app/models/katello/glue/elastic_search/content_view_erratum_filter_rule.rb b/app/models/katello/glue/elastic_search/content_view_erratum_filter_rule.rb deleted file mode 100644 index 4f8d7f64eef..00000000000 --- a/app/models/katello/glue/elastic_search/content_view_erratum_filter_rule.rb +++ /dev/null @@ -1,31 +0,0 @@ -module Katello - module Glue::ElasticSearch::ContentViewErratumFilterRule - extend ActiveSupport::Concern - - included do - include Ext::IndexedModel - - index_options :extended_json => :extended_index_attrs, - :json => { :only => [:id, - :errata_id, - :start_date, - :end_date, - :types, - :created_at, - :updated_at] - }, - :display_attrs => [:name] - - mapping do - indexes :errata_id, :type => 'string', :analyzer => :snowball - indexes :errata_id_sort, :type => 'string', :index => :not_analyzed - end - end - - def extended_index_attrs - { - :content_view_filter_id => self.content_view_filter_id - } - end - end -end diff --git a/app/models/katello/glue/elastic_search/content_view_package_filter_rule.rb b/app/models/katello/glue/elastic_search/content_view_package_filter_rule.rb deleted file mode 100644 index 0ff6303fdd1..00000000000 --- a/app/models/katello/glue/elastic_search/content_view_package_filter_rule.rb +++ /dev/null @@ -1,32 +0,0 @@ -module Katello - module Glue::ElasticSearch::ContentViewPackageFilterRule - extend ActiveSupport::Concern - - included do - include Ext::IndexedModel - - index_options :extended_json => :extended_index_attrs, - :json => { :only => [:id, - :name, - :version, - :min_version, - :max_version, - :created_at, - :updated_at] - }, - :display_attrs => [:name] - - mapping do - indexes :name, :type => 'string', :analyzer => :kt_name_analyzer - indexes :name_sort, :type => 'string', :index => :not_analyzed - end - end - - def extended_index_attrs - { - :name_sort => name.downcase, - :content_view_filter_id => self.content_view_filter_id - } - end - end -end diff --git a/app/models/katello/glue/elastic_search/content_view_package_group_filter_rule.rb b/app/models/katello/glue/elastic_search/content_view_package_group_filter_rule.rb deleted file mode 100644 index e365943d3a6..00000000000 --- a/app/models/katello/glue/elastic_search/content_view_package_group_filter_rule.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Katello - module Glue::ElasticSearch::ContentViewPackageGroupFilterRule - extend ActiveSupport::Concern - - included do - include Ext::IndexedModel - - index_options :extended_json => :extended_index_attrs, - :json => { :only => [:id, - :name, - :created_at, - :updated_at] - }, - :display_attrs => [:name] - - mapping do - indexes :name, :type => 'string', :analyzer => :kt_name_analyzer - indexes :name_sort, :type => 'string', :index => :not_analyzed - end - end - - def extended_index_attrs - { - :name_sort => name.downcase, - :content_view_filter_id => self.content_view_filter_id - } - end - end -end diff --git a/test/controllers/api/v2/content_view_filter_rules_controller_test.rb b/test/controllers/api/v2/content_view_filter_rules_controller_test.rb index 01614cbeb41..fd659e1efcc 100644 --- a/test/controllers/api/v2/content_view_filter_rules_controller_test.rb +++ b/test/controllers/api/v2/content_view_filter_rules_controller_test.rb @@ -18,9 +18,6 @@ def permissions def setup setup_controller_defaults_api - @request.env['HTTP_ACCEPT'] = 'application/json' - @request.env['CONTENT_TYPE'] = 'application/json' - @fake_search_service = @controller.load_search_service(Support::SearchService::FakeSearchService.new) models permissions end