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.



915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'lib/parade_db/search_methods.rb', line 915

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.



898
899
900
# File 'lib/parade_db/search_methods.rb', line 898

def connection
  @connection
end

#relationObject (readonly)

Returns the value of attribute relation.



898
899
900
# File 'lib/parade_db/search_methods.rb', line 898

def relation
  @relation
end

Class Method Details

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



900
901
902
903
904
905
906
907
908
909
910
911
912
913
# File 'lib/parade_db/search_methods.rb', line 900

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



934
935
936
# File 'lib/parade_db/search_methods.rb', line 934

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

#sqlObject



930
931
932
# File 'lib/parade_db/search_methods.rb', line 930

def sql
  relation.to_sql
end