Class: Container::Autocomplete
Instance Attribute Summary
#dynamic_limit, #options, #project_id, #query_string, #terms
Instance Method Summary
collapse
#alphabetic_strings, #alphanumeric_strings, #attribute_exact_facet, #autocomplete_cached, #autocomplete_cached_wildcard_anywhere, #autocomplete_common_name_exact, #autocomplete_common_name_like, #autocomplete_exact_id, #autocomplete_exactly_named, #autocomplete_named, #autocomplete_ordered_wildcard_pieces_in_cached, #build_terms, #cached, #combine_or_clauses, #common_name_name, #common_name_table, #common_name_wild_pieces, #end_wildcard, #exactly_named, #fragments, #initialize, #integers, #levenshtein_distance, #match_ordered_wildcard_pieces_in_cached, #match_wildcard_end_in_cached, #match_wildcard_in_cached, #named, #no_terms?, #only_ids, #only_integers?, #parent, #parent_child_join, #parent_child_where, #pieces, #result, #scope, #start_and_end_wildcard, #start_wildcard, #string_fragments, #wildcard_pieces, #wildcard_wrapped_integers, #wildcard_wrapped_years, #with_cached, #with_cached_like, #with_id, #with_project_id, #year_letter, #years
Constructor Details
This class inherits a constructor from Queries::Query
Instance Method Details
#autocomplete ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/queries/container/autocomplete.rb', line 34
def autocomplete
updated_queries = base_queries
result = []
updated_queries.each do |q|
result += q.to_a
result.uniq!
break if result.count > 39
end
result[0..39]
end
|
#base_queries ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/queries/container/autocomplete.rb', line 13
def base_queries
queries = [
autocomplete_identifier_cached_exact,
autocomplete_identifier_identifier_exact,
autocomplete_exact_id,
autocomplete_identifier_cached_like,
]
queries.compact!
return [] if queries.nil?
updated_queries = []
queries.each_with_index do |q ,i|
a = q.where(project_id: project_id) if project_id
a ||= q
updated_queries[i] = a
end
updated_queries
end
|
#base_query ⇒ Object
9
10
11
|
# File 'lib/queries/container/autocomplete.rb', line 9
def base_query
::Container.select('containers.*')
end
|
#table ⇒ Arel::Table
5
6
7
|
# File 'lib/queries/container/autocomplete.rb', line 5
def table
::Container.arel_table
end
|