Class: Queries::CommonName::Filter
- Inherits:
-
Query::Filter
- Object
- Query
- Query::Filter
- Queries::CommonName::Filter
- Defined in:
- lib/queries/common_name/filter.rb
Constant Summary collapse
- PARAMS =
[ :common_name_id, :geographic_area_id, :language_id, :name, :otu_id, otu_id: [], common_name_id: [], ].freeze
Constants inherited from Query::Filter
Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES
Instance Attribute Summary collapse
-
#geographic_area_id ⇒ Object
Query variables.
-
#language_id ⇒ Object
Query variables.
-
#name ⇒ Object
Query variables.
-
#otu_id ⇒ Object
Query variables.
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
Instance Method Summary collapse
- #and_clauses ⇒ Object
- #common_name_id ⇒ Object
- #geographic_area_id_facet ⇒ Object
-
#initialize(query_params) ⇒ Filter
constructor
A new instance of Filter.
- #language_id_facet ⇒ Object
- #name_facet ⇒ Object
- #otu_id_facet ⇒ Object
Methods inherited from Query::Filter
#all, #all_and_clauses, #all_merge_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, #merge_clauses, #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.
18 19 20 21 22 23 24 |
# File 'lib/queries/common_name/filter.rb', line 18 def initialize(query_params) super @geographic_area_id = params[:geographic_area_id] @language_id = params[:language_id] @name = params[:name] @otu_id = params[:otu_id] end |
Instance Attribute Details
#geographic_area_id ⇒ Object
Query variables
16 17 18 |
# File 'lib/queries/common_name/filter.rb', line 16 def geographic_area_id @geographic_area_id end |
#language_id ⇒ Object
Query variables
16 17 18 |
# File 'lib/queries/common_name/filter.rb', line 16 def language_id @language_id end |
#name ⇒ Object
Query variables
16 17 18 |
# File 'lib/queries/common_name/filter.rb', line 16 def name @name end |
#otu_id ⇒ Object
Query variables
16 17 18 |
# File 'lib/queries/common_name/filter.rb', line 16 def otu_id @otu_id end |
Instance Method Details
#and_clauses ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/queries/common_name/filter.rb', line 62 def and_clauses [ geographic_area_id_facet, language_id_facet, name_facet, otu_id_facet, ] end |
#common_name_id ⇒ Object
38 39 40 |
# File 'lib/queries/common_name/filter.rb', line 38 def common_name_id [@common_name_id].flatten.compact end |
#geographic_area_id_facet ⇒ Object
57 58 59 60 |
# File 'lib/queries/common_name/filter.rb', line 57 def geographic_area_id_facet return nil if geographic_area_id.empty? table[:geographic_area_id].in(geographic_area_id) end |
#language_id_facet ⇒ Object
47 48 49 50 |
# File 'lib/queries/common_name/filter.rb', line 47 def language_id_facet return nil if language_id.empty? table[:language_id].in(language_id) end |
#name_facet ⇒ Object
52 53 54 55 |
# File 'lib/queries/common_name/filter.rb', line 52 def name_facet return nil if name.blank? table[:name].eq(name) end |
#otu_id_facet ⇒ Object
42 43 44 45 |
# File 'lib/queries/common_name/filter.rb', line 42 def otu_id_facet return nil if otu_id.empty? table[:otu_id].in(otu_id) end |