Class: Queries::SqedDepiction::Filter

Inherits:
Query::Filter show all
Includes:
Helpers
Defined in:
lib/queries/sqed_depiction/filter.rb

Constant Summary collapse

COLLECTION_OBJECT_FILTER_PARAMS =
[
  :collecting_event,
  :taxon_determinations,
  :with_buffered_determinations,
  :with_buffered_collecting_event,
  :with_buffered_other_labels,

  :identifier,
  :identifier_end,
  :identifier_exact,
  :identifier_start,
  :identifier_type,
  :identifiers,
  :local_identifiers,
  :global_identifiers,
  :match_identifiers,
  :match_identifiers_delimiter,
  :match_identifiers_type,
  :namespace_id,
  identifier_type: [],
].freeze
PARAMS =
[
  *COLLECTION_OBJECT_FILTER_PARAMS,
  :sqed_depiction_id,
  sqed_depiction_id: [],
].freeze

Constants inherited from Query::Filter

Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES

Instance Attribute Summary collapse

Attributes inherited from Query::Filter

#api, #asserted_distribution_query, #biological_association_query, #biological_associations_graph_query, #collecting_event_query, #collection_object_query, #content_query, #controlled_vocabulary_term_query, #data_attribute_query, #descriptor_query, #document_query, #dwc_occurrence_query, #extract_query, #field_occurrence_query, #image_query, #loan_query, #object_global_id, #observation_query, #order_by, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #recent_target, #taxon_name_query, #venn, #venn_mode

Attributes inherited from Query

#query_string, #terms

Instance Method Summary collapse

Methods included from Helpers

#boolean_param, #integer_param

Methods inherited from Query::Filter

#all, #all_and_clauses, #all_merge_clauses, #and_clauses, #annotator_and_clauses, #annotator_merge_clauses, annotator_params, api_except_params, api_excluded_params, #apply_venn, #attribute_exact_facet, base_filter, base_query_name, base_query_to_h, #deep_permit, included_annotator_facets, instantiated_base_filter, inverted_subqueries, #model_id_facet, #object_global_id_facet, #only_project?, params, #permitted_params, #process_url_into_params, #project_id_facet, query_name, #query_name, #set_nested_queries, #shared_and_clauses, #subquery_vector, #target_and_clauses, #venn_query

Methods inherited from Query

#alphabetic_strings, #alphanumeric_strings, base_name, #base_name, #base_query, #build_terms, #cached_facet, #end_wildcard, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #no_terms?, referenced_klass, #referenced_klass, #referenced_klass_except, #referenced_klass_intersection, #referenced_klass_union, #start_and_end_wildcard, #start_wildcard, #table, #wildcard_pieces

Constructor Details

#initialize(query_params) ⇒ Filter

Returns a new instance of Filter.



39
40
41
42
43
44
45
46
# File 'lib/queries/sqed_depiction/filter.rb', line 39

def initialize(query_params)
  super

  @sqed_depiction_id = params[:sqed_depiction_id]
  @base_collection_object_filter_params = params.select{|k,v| COLLECTION_OBJECT_FILTER_PARAMS.include?(k) ? k : nil}
  @params = @params.delete_if{|k,v| @base_collection_object_filter_params[k].present?}
  @no_identifier_clauses = true
end

Instance Attribute Details

#base_collection_object_filter_paramsObject

Returns Hash.

Returns:

  • Hash



35
36
37
# File 'lib/queries/sqed_depiction/filter.rb', line 35

def base_collection_object_filter_params
  @base_collection_object_filter_params
end

#sqed_depiction_idObject

Returns the value of attribute sqed_depiction_id.



37
38
39
# File 'lib/queries/sqed_depiction/filter.rb', line 37

def sqed_depiction_id
  @sqed_depiction_id
end

Instance Method Details

#base_collection_object_query_facetObject



52
53
54
55
# File 'lib/queries/sqed_depiction/filter.rb', line 52

def base_collection_object_query_facet
  q = ::Queries::CollectionObject::Filter.new(base_collection_object_filter_params).all
  ::SqedDepiction.joins(:collection_object).with(collection_objects: q)
end

#merge_clausesObject



57
58
59
# File 'lib/queries/sqed_depiction/filter.rb', line 57

def merge_clauses
  [ base_collection_object_query_facet ]
end