Skip to content

Commit

Permalink
remove support for mapping by predicate from search query
Browse files Browse the repository at this point in the history
  • Loading branch information
elrayle committed Nov 22, 2019
1 parent 7f8ccc4 commit 3c71303
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
project: qa

- samvera/engine_cart_generate:
cache_key: v7-internal-test-app-{{ checksum "qa.gemspec" }}-{{ checksum "spec/test_app_templates/lib/generators/test_app_generator.rb" }}-{{ checksum "lib/generators/qa/install/install_generator.rb" }}-<< parameters.rails_version >>-<< parameters.ruby_version >>
cache_key: v11-internal-test-app-{{ checksum "qa.gemspec" }}-{{ checksum "spec/test_app_templates/lib/generators/test_app_generator.rb" }}-{{ checksum "lib/generators/qa/install/install_generator.rb" }}-<< parameters.rails_version >>-<< parameters.ruby_version >>

- samvera/bundle_for_gem:
ruby_version: << parameters.ruby_version >>
Expand Down
32 changes: 2 additions & 30 deletions lib/qa/authorities/linked_data/search_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,11 @@ def normalize_results
end

def map_results
predicate_map = preds_for_search
ldpath_map = ldpaths_for_search

raise Qa::InvalidConfiguration, "do not specify results using both predicates and ldpath in search configuration for linked data authority #{authority_name} (ldpath is preferred)" if predicate_map.present? && ldpath_map.present? # rubocop:disable Metrics/LineLength
raise Qa::InvalidConfiguration, "must specify label_ldpath or label_predicate in search configuration for linked data authority #{authority_name} (label_ldpath is preferred)" unless ldpath_map.key?(:label) || predicate_map.key?(:label) # rubocop:disable Metrics/LineLength
raise Qa::InvalidConfiguration, "must specify label_ldpath in search configuration for linked data authority #{authority_name}" unless ldpath_map.key?(:label) # rubocop:disable Metrics/LineLength

if predicate_map.present?
Qa.deprecation_warning(
in_msg: 'Qa::Authorities::LinkedData::SearchQuery',
msg: "defining results using predicates in search config is deprecated; update to define using ldpaths (authority: #{authority_name})"
)
end

results_mapper_service.map_values(graph: filtered_graph, prefixes: prefixes, ldpath_map: ldpath_map,
predicate_map: predicate_map, sort_key: :sort,
results_mapper_service.map_values(graph: filtered_graph, prefixes: prefixes, ldpath_map: ldpath_map,sort_key: :sort,
preferred_language: language, context_map: context_map)
end

Expand Down Expand Up @@ -129,24 +119,6 @@ def sort_ldpath
@sort_ldpath ||= search_config.results_sort_ldpath
end

def preds_for_search
label_pred_uri = search_config.results_label_predicate(suppress_deprecation_warning: true)
return {} if label_pred_uri.blank?
preds = { label: label_pred_uri, uri: :subject_uri }
preds[:altlabel] = search_config.results_altlabel_predicate unless search_config.results_altlabel_predicate.nil?
preds[:id] = id_predicate.present? ? id_predicate : :subject_uri
preds[:sort] = sort_predicate.present? ? sort_predicate : preds[:label]
preds
end

def id_predicate
@id_predicate ||= search_config.results_id_predicate
end

def sort_predicate
@sort_predicate ||= search_config.results_sort_predicate
end

def convert_results_to_json(results)
json_results = []
results.each { |result| json_results << convert_result_to_json(result) }
Expand Down

0 comments on commit 3c71303

Please sign in to comment.