Class: Queries::Namespace::Filter
Constant Summary
collapse
- PARAMS =
[
:institution,
:is_virtual,
:name,
:namespace_id,
:short_name,
:verbatim_name,
namespace_id: [],
].freeze
Query::Filter::FILTER_QUERIES, Query::Filter::SUBQUERIES
Instance Attribute Summary collapse
#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
#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.
36
37
38
39
40
41
42
43
44
|
# File 'lib/queries/namespace/filter.rb', line 36
def initialize(query_params)
super
@institution = params[:institution]
@is_virtual = boolean_param(params, :is_virtual)
@name = params[:name]
@namespace_id = params[:namespace_id]
@short_name = params[:short_name]
@verbatim_short_name = params[:verbatim_short_name]
end
|
Instance Attribute Details
#institution ⇒ Object
19
20
21
|
# File 'lib/queries/namespace/filter.rb', line 19
def institution
@institution
end
|
#is_virtual ⇒ Object
34
35
36
|
# File 'lib/queries/namespace/filter.rb', line 34
def is_virtual
@is_virtual
end
|
#name ⇒ Array
23
24
25
|
# File 'lib/queries/namespace/filter.rb', line 23
def name
@name
end
|
#namespace_id ⇒ Object
Returns the value of attribute namespace_id.
15
16
17
|
# File 'lib/queries/namespace/filter.rb', line 15
def namespace_id
@namespace_id
end
|
#short_name ⇒ Array
27
28
29
|
# File 'lib/queries/namespace/filter.rb', line 27
def short_name
@short_name
end
|
#verbatim_short_name ⇒ Array
31
32
33
|
# File 'lib/queries/namespace/filter.rb', line 31
def verbatim_short_name
@verbatim_short_name
end
|
Instance Method Details
#and_clauses ⇒ Object
87
88
89
90
91
92
93
94
95
|
# File 'lib/queries/namespace/filter.rb', line 87
def and_clauses
[
institution_facet,
is_virtual_facet,
name_facet,
short_name_facet,
verbatim_name_facet,
]
end
|
#institution_facet ⇒ Object
77
78
79
80
|
# File 'lib/queries/namespace/filter.rb', line 77
def institution_facet
return nil if institution.nil?
table[:institution].matches('%' + insititution + '%')
end
|
#is_virtual_facet ⇒ Object
82
83
84
85
|
# File 'lib/queries/namespace/filter.rb', line 82
def is_virtual_facet
return nil if is_virtual.nil?
table[:is_virtual].eq(is_virtual)
end
|
#name_facet ⇒ Object
62
63
64
65
|
# File 'lib/queries/namespace/filter.rb', line 62
def name_facet
return nil if name.empty?
table[:name].in(name)
end
|
#short_name_facet ⇒ Object
67
68
69
70
|
# File 'lib/queries/namespace/filter.rb', line 67
def short_name_facet
return nil if short_name.empty?
table[:short_name].in(short_name)
end
|
#verbatim_name_facet ⇒ Object
72
73
74
75
|
# File 'lib/queries/namespace/filter.rb', line 72
def verbatim_name_facet
return nil if verbatim_short_name.empty?
table[:verbatim_short_name].in(verbatim_short_name)
end
|