Class: Queries::RepositoryAutocompleteQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/queries/repository_autocomplete_query.rb

Instance Attribute Summary

Attributes inherited from Query

#dynamic_limit, #project_id, #query_string, #terms

Instance Method Summary (collapse)

Methods inherited from Query

#alphabetic_strings, #autocomplete, #build_terms, #cached, #combine_or_clauses, #end_wildcard, #exactly_named, #fragments, #identifier_table, #initialize, #integers, #named, #no_digits, #only_ids, #only_integers?, #parent, #parent_child_join, #parent_child_where, #pieces, #result, #scope, #start_and_end_wildcard, #start_wildcard, #strings, #wildcard_wrapped_integers, #with_id, #with_identifier, #with_identifier_like, #with_project_id, #years

Constructor Details

This class inherits a constructor from Queries::Query

Instance Method Details

- (Object) acronym



17
18
19
# File 'lib/queries/repository_autocomplete_query.rb', line 17

def acronym
  table[:acronym].matches_any(terms)
end

- (Object) all



9
10
11
# File 'lib/queries/repository_autocomplete_query.rb', line 9

def all 
  Repository.where(where_sql).order('name, char_length(name)').limit(40)
end

- (Object) table



13
14
15
# File 'lib/queries/repository_autocomplete_query.rb', line 13

def table
  Repository.arel_table
end

- (Object) where_sql



5
6
7
# File 'lib/queries/repository_autocomplete_query.rb', line 5

def where_sql
  named.or(acronym).to_sql
end