Skip to content

Commit

Permalink
Remove deprecated Hyrax::SolrQueryBuilderService
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpierce committed Oct 20, 2023
1 parent 07e858d commit 2ccc32c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def with_pagination(solr_parameters)
def show_only_other_collections_of_the_same_collection_type(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += [
Hyrax::SolrQueryBuilderService.construct_query(Hyrax.config.collection_type_index_field => @collection.collection_type_gid),
Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: { Hyrax.config.collection_type_index_field => @collection.collection_type_gid }).build,
"-{!graph from=id to=member_of_collection_ids_ssim#{' maxDepth=1' if @nest_direction == :as_parent}}id:#{@collection.id}",
"-{!graph to=id from=member_of_collection_ids_ssim#{' maxDepth=1' if @nest_direction == :as_child}}id:#{@collection.id}"
]
Expand Down
8 changes: 4 additions & 4 deletions app/search_builders/hyrax/my/find_works_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ def initialize(context)

def filter_on_title(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += [Hyrax::SolrQueryBuilderService.construct_query(title_tesim: @q)]
solr_parameters[:fq] += [Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: { title_tesim: @q }).build]
end

def show_only_other_works(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += ["-#{Hyrax::SolrQueryBuilderService.construct_query_for_ids([@id])}"]
solr_parameters[:fq] += ["-#{Hyrax::SolrQueryService.new.with_ids(ids: [@id]).build}"]
end

def show_only_works_not_child(solr_parameters)
ids = Hyrax::SolrService.query("{!field f=id}#{@id}", fl: "member_ids_ssim", rows: 10_000).flat_map { |x| x.fetch("member_ids_ssim", []) }
solr_parameters[:fq] ||= []
solr_parameters[:fq] += ["-#{Hyrax::SolrQueryBuilderService.construct_query_for_ids([ids])}"]
solr_parameters[:fq] += ["-#{Hyrax::SolrQueryService.new.with_ids(ids: [ids]).build}"]
end

def show_only_works_not_parent(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += [
"-" + Hyrax::SolrQueryBuilderService.construct_query(member_ids_ssim: @id)
"-" + Hyrax::SolrQueryService.new.with_field_pairs(field_pairs: { member_ids_ssim: @id }).build
]
end

Expand Down
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/my/highlights_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class Hyrax::My::HighlightsSearchBuilder < Hyrax::SearchBuilder
def show_only_highlighted_works(solr_parameters)
ids = scope.current_user.trophies.pluck(:work_id)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += [Hyrax::SolrQueryBuilderService.construct_query_for_ids([ids])]
solr_parameters[:fq] += [Hyrax::SolrQueryService.new.with_ids(ids: [ids]).build]
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ParentCollectionSearchBuilder < Hyrax::CollectionSearchBuilder
# include filters into the query to only include the collections containing this item
def include_item_ids(solr_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] += [Hyrax::SolrQueryBuilderService.construct_query_for_ids([item.member_of_collection_ids])]
solr_parameters[:fq] += [Hyrax::SolrQueryService.new.with_ids(ids: [item.member_of_collection_ids]).build]
end
end
end
109 changes: 0 additions & 109 deletions app/services/hyrax/solr_query_builder_service.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

it "is successful" do
subject
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([work.id])]
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [work.id]).build]
end
end

Expand All @@ -40,7 +40,7 @@
it "is successful" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([ids])]
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [ids]).build]
end
end

Expand Down
25 changes: 0 additions & 25 deletions spec/services/hyrax/solr_query_builder_service_spec.rb

This file was deleted.

0 comments on commit 2ccc32c

Please sign in to comment.