Class: Queries::SqedDepiction::Filter
- Inherits:
-
Query::Filter
- Object
- Query
- Query::Filter
- Queries::SqedDepiction::Filter
- 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, :local_identifiers, ].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
-
#base_collection_object_filter_params ⇒ Object
Hash.
-
#sqed_depiction_id ⇒ Object
Returns the value of attribute sqed_depiction_id.
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, #extract_query, #image_query, #loan_query, #object_global_id, #observation_query, #otu_query, #page, #paginate, #params, #per, #person_query, #project_id, #recent, #taxon_name_query
Attributes inherited from Query
Instance Method Summary collapse
-
#base_collection_object_query_facet ⇒ Object
TODO: use WITH.
-
#initialize(query_params) ⇒ Filter
constructor
A new instance of Filter.
-
#local_identifiers_facet ⇒ Object
TODO: will need to consider moving Identifies out of base class because of edge cases like this (less inheritence, more composition) applies to CO, not here.
- #merge_clauses ⇒ Object
Methods included from Helpers
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, #attribute_exact_facet, #deep_permit, included_annotator_facets, inverted_subqueries, #model_id_facet, #object_global_id_facet, params, #permitted_params, #project_id_facet, #set_nested_queries, #shared_and_clauses, #subquery_vector
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.
27 28 29 30 31 32 |
# File 'lib/queries/sqed_depiction/filter.rb', line 27 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} end |
Instance Attribute Details
#base_collection_object_filter_params ⇒ Object
Returns Hash.
23 24 25 |
# File 'lib/queries/sqed_depiction/filter.rb', line 23 def base_collection_object_filter_params @base_collection_object_filter_params end |
#sqed_depiction_id ⇒ Object
Returns the value of attribute sqed_depiction_id.
25 26 27 |
# File 'lib/queries/sqed_depiction/filter.rb', line 25 def sqed_depiction_id @sqed_depiction_id end |
Instance Method Details
#base_collection_object_query_facet ⇒ Object
TODO: use WITH
46 47 48 49 |
# File 'lib/queries/sqed_depiction/filter.rb', line 46 def base_collection_object_query_facet q = ::Queries::CollectionObject::Filter.new(base_collection_object_filter_params).all ::SqedDepiction.joins(:collection_object).where(collection_objects: q) end |
#local_identifiers_facet ⇒ Object
TODO: will need to consider moving Identifies out of base class because of edge cases like this (less inheritence, more composition) applies to CO, not here
41 42 43 |
# File 'lib/queries/sqed_depiction/filter.rb', line 41 def local_identifiers_facet nil end |
#merge_clauses ⇒ Object
51 52 53 |
# File 'lib/queries/sqed_depiction/filter.rb', line 51 def merge_clauses [ base_collection_object_query_facet ] end |