Class: Turbopuffer::Models::Query

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/turbopuffer/models/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(aggregate_by: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, rank_by: nil, top_k: nil) ⇒ Object

Some parameter documentations has been truncated, see Turbopuffer::Models::Query for more details.

Query, filter, full-text search and vector search documents.

Parameters:

  • aggregate_by (Hash{Symbol=>Object}) (defaults to: nil)

    Aggregations to compute over all documents in the namespace that match the filte

  • distance_metric (Symbol, Turbopuffer::Models::DistanceMetric) (defaults to: nil)

    A function used to calculate vector similarity.

  • exclude_attributes (Array<String>) (defaults to: nil)

    List of attribute names to exclude from the response. All other attributes will

  • filters (Object) (defaults to: nil)

    Exact filters for attributes to refine search results for. Think of it as a SQL

  • group_by (Array<String>) (defaults to: nil)

    Groups documents by the specified attributes (the “group key”) before computing

  • include_attributes (Boolean, Array<String>) (defaults to: nil)

    Whether to include attributes in the response.

  • rank_by (Object) (defaults to: nil)

    How to rank the documents in the namespace.

  • top_k (Integer) (defaults to: nil)

    The number of results to return.



# File 'lib/turbopuffer/models/query.rb', line 58


Instance Attribute Details

#aggregate_byHash{Symbol=>Object}?

Aggregations to compute over all documents in the namespace that match the filters.

Returns:

  • (Hash{Symbol=>Object}, nil)


11
# File 'lib/turbopuffer/models/query.rb', line 11

optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

#distance_metricSymbol, ...

A function used to calculate vector similarity.

Returns:



17
# File 'lib/turbopuffer/models/query.rb', line 17

optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }

#exclude_attributesArray<String>?

List of attribute names to exclude from the response. All other attributes will be included in the response.

Returns:

  • (Array<String>, nil)


24
# File 'lib/turbopuffer/models/query.rb', line 24

optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]

#filtersObject?

Exact filters for attributes to refine search results for. Think of it as a SQL WHERE clause.

Returns:

  • (Object, nil)


31
# File 'lib/turbopuffer/models/query.rb', line 31

optional :filters, Turbopuffer::Internal::Type::Unknown

#group_byArray<String>?

Groups documents by the specified attributes (the “group key”) before computing aggregates. Aggregates are computed separately for each group.

Returns:

  • (Array<String>, nil)


38
# File 'lib/turbopuffer/models/query.rb', line 38

optional :group_by, Turbopuffer::Internal::Type::ArrayOf[String]

#include_attributesBoolean, ...

Whether to include attributes in the response.

Returns:

  • (Boolean, Array<String>, nil)


44
# File 'lib/turbopuffer/models/query.rb', line 44

optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }

#rank_byObject?

How to rank the documents in the namespace.

Returns:

  • (Object, nil)


50
# File 'lib/turbopuffer/models/query.rb', line 50

optional :rank_by, Turbopuffer::Internal::Type::Unknown

#top_kInteger?

The number of results to return.

Returns:

  • (Integer, nil)


56
# File 'lib/turbopuffer/models/query.rb', line 56

optional :top_k, Integer