Class: ParadeDB::SearchMethods::FacetQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/parade_db/search_methods.rb

Overview

—- Facet Query helper —-

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation:, primary_key:, builder:, fields:, size:, order:, missing:, agg:, exact:, connection:) ⇒ FacetQuery

Returns a new instance of FacetQuery.



923
924
925
926
927
928
929
930
931
932
933
934
935
936
# File 'lib/parade_db/search_methods.rb', line 923

def initialize(relation:, primary_key:, builder:, fields:, size:, order:, missing:, agg:, exact:, connection:)
  @connection = connection
  @relation = build_relation(
    relation: relation,
    primary_key: primary_key,
    builder: builder,
    fields: fields,
    size: size,
    order: order,
    missing: missing,
    agg: agg,
    exact: exact
  )
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



906
907
908
# File 'lib/parade_db/search_methods.rb', line 906

def connection
  @connection
end

#relationObject (readonly)

Returns the value of attribute relation.



906
907
908
# File 'lib/parade_db/search_methods.rb', line 906

def relation
  @relation
end

Class Method Details

.build(relation:, primary_key:, builder:, fields:, size:, order:, missing:, agg:, exact:, connection:) ⇒ Object



908
909
910
911
912
913
914
915
916
917
918
919
920
921
# File 'lib/parade_db/search_methods.rb', line 908

def self.build(relation:, primary_key:, builder:, fields:, size:, order:, missing:, agg:, exact:, connection:)
  new(
    relation: relation,
    primary_key: primary_key,
    builder: builder,
    fields: fields,
    size: size,
    order: order,
    missing: missing,
    agg: agg,
    exact: exact,
    connection: connection
  )
end

Instance Method Details

#executeObject



942
943
944
# File 'lib/parade_db/search_methods.rb', line 942

def execute
  parse_facets(connection.select_one(sql))
end

#sqlObject



938
939
940
# File 'lib/parade_db/search_methods.rb', line 938

def sql
  relation.to_sql
end