Class: Queries::GeographicAreaAutocompleteQuery
- Inherits:
-
Query
- Object
- Query
- Queries::GeographicAreaAutocompleteQuery
- Defined in:
- lib/queries/geographic_area_autocomplete_query.rb
Instance Attribute Summary
Attributes inherited from Query
#dynamic_limit, #options, #project_id, #query_string, #terms
Instance Method Summary (collapse)
- - (Scope) all
- - (Arel::Table) table
-
- (String) where_sql
TODO: use or_clauses.
Methods inherited from Query
#alphabetic_strings, #autocomplete, #autocomplete_cached, #autocomplete_cached_wildcard_anywhere, #autocomplete_ordered_wildcard_pieces_in_cached, #autocomplete_start_date, #build_terms, #cached, #combine_or_clauses, #end_wildcard, #exactly_named, #fragments, #initialize, #integers, #match_ordered_wildcard_pieces_in_cached, #match_wildcard_cached, #named, #no_digits, #only_ids, #only_integers?, #parent, #parent_child_join, #parent_child_where, #pieces, #result, #scope, #simple_date, #start_and_end_wildcard, #start_wildcard, #wildcard_pieces, #wildcard_wrapped_integers, #wildcard_wrapped_years, #with_id, #with_project_id, #with_start_date, #year_letter, #years
Constructor Details
This class inherits a constructor from Queries::Query
Instance Method Details
- (Scope) all
12 13 14 15 16 17 18 |
# File 'lib/queries/geographic_area_autocomplete_query.rb', line 12 def all ( GeographicArea.where(name: query_string).all + GeographicArea.joins(parent_child_join).where(Arel.sql(parent_child_where.to_sql)).limit(5).all + GeographicArea.where(Arel.sql(where_sql)).includes(:geographic_area_type, :geographic_items).order(Arel.sql('length(name)')).limit(dynamic_limit).all ).flatten.compact.uniq end |
- (Arel::Table) table
21 22 23 |
# File 'lib/queries/geographic_area_autocomplete_query.rb', line 21 def table GeographicArea.arel_table end |
- (String) where_sql
TODO: use or_clauses
7 8 9 |
# File 'lib/queries/geographic_area_autocomplete_query.rb', line 7 def where_sql named.to_sql end |