Module: Queries::Concerns::Identifiers

Extended by:
ActiveSupport::Concern
Included in:
Query
Defined in:
lib/queries/concerns/identifiers.rb

Overview

Helpers for queries that reference Identifier

Instance Method Summary (collapse)

Instance Method Details

- (Object) autocomplete_identifier_cached_exact

Autocomplete



42
43
44
# File 'lib/queries/concerns/identifiers.rb', line 42

def autocomplete_identifier_cached_exact
  base_query.joins(:identifiers).where(with_identifier.to_sql)
end

- (Object) autocomplete_identifier_cached_like



46
47
48
# File 'lib/queries/concerns/identifiers.rb', line 46

def autocomplete_identifier_cached_like
  base_query.joins(:identifiers).where(with_identifier_like.to_sql)
end

- (Arel::Table) identifier_table

Returns:

  • (Arel::Table)


7
8
9
# File 'lib/queries/concerns/identifiers.rb', line 7

def identifier_table
  ::Identifier.arel_table
end

- (Arel::Nodes::Equality) with_cached

Returns:

  • (Arel::Nodes::Equality)


25
26
27
# File 'lib/queries/concerns/identifiers.rb', line 25

def with_cached
  identifier_table[:cached].eq(query_string)
end

- (Arel::Nodes::Equality) with_identifier

Returns:

  • (Arel::Nodes::Equality)


20
21
22
# File 'lib/queries/concerns/identifiers.rb', line 20

def with_identifier
  identifier_table[:identifier].eq(query_string)
end

- (Arel::Nodes::Grouping) with_identifier_like

Returns:

  • (Arel::Nodes::Grouping)


12
13
14
15
16
# File 'lib/queries/concerns/identifiers.rb', line 12

def with_identifier_like
  a = [ start_and_end_wildcard ]
  a = a + wildcard_wrapped_integers
  identifier_table[:cached].matches_any(a)
end

- (Arel::Nodes::Equality) with_identifier_wildcard_anywhere

Returns:

  • (Arel::Nodes::Equality)


35
36
37
# File 'lib/queries/concerns/identifiers.rb', line 35

def with_identifier_wildcard_anywhere
  identifier_table[:cached].matches(start_and_end_wildcard)
end

- (Arel::Nodes::Equality) with_identifier_wildcard_end

Returns:

  • (Arel::Nodes::Equality)


30
31
32
# File 'lib/queries/concerns/identifiers.rb', line 30

def with_identifier_wildcard_end
  identifier_table[:cached].matches(end_wildcard)
end