Class: Turbopuffer::Models::NamespaceMultiQueryParams::Query

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

Defined Under Namespace

Modules: Limit

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, limit: nil, rank_by: nil, top_k: nil) ⇒ Object

Some parameter documentations has been truncated, see Turbopuffer::Models::NamespaceMultiQueryParams::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.

  • limit (Integer, Turbopuffer::Models::Limit) (defaults to: nil)

    Limits the documents returned by a query.

  • 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.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 44

class Query < Turbopuffer::Internal::Type::BaseModel
  # @!attribute aggregate_by
  #   Aggregations to compute over all documents in the namespace that match the
  #   filters.
  #
  #   @return [Hash{Symbol=>Object}, nil]
  optional :aggregate_by, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]

  # @!attribute distance_metric
  #   A function used to calculate vector similarity.
  #
  #   @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
  optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }

  # @!attribute exclude_attributes
  #   List of attribute names to exclude from the response. All other attributes will
  #   be included in the response.
  #
  #   @return [Array<String>, nil]
  optional :exclude_attributes, Turbopuffer::Internal::Type::ArrayOf[String]

  # @!attribute filters
  #   Exact filters for attributes to refine search results for. Think of it as a SQL
  #   WHERE clause.
  #
  #   @return [Object, nil]
  optional :filters, Turbopuffer::Internal::Type::Unknown

  # @!attribute group_by
  #   Groups documents by the specified attributes (the "group key") before computing
  #   aggregates. Aggregates are computed separately for each group.
  #
  #   @return [Array<String>, nil]
  optional :group_by, Turbopuffer::Internal::Type::ArrayOf[String]

  # @!attribute include_attributes
  #   Whether to include attributes in the response.
  #
  #   @return [Boolean, Array<String>, nil]
  optional :include_attributes, union: -> { Turbopuffer::IncludeAttributes }

  # @!attribute limit
  #   Limits the documents returned by a query.
  #
  #   @return [Integer, Turbopuffer::Models::Limit, nil]
  optional :limit, union: -> { Turbopuffer::NamespaceMultiQueryParams::Query::Limit }

  # @!attribute rank_by
  #   How to rank the documents in the namespace.
  #
  #   @return [Object, nil]
  optional :rank_by, Turbopuffer::Internal::Type::Unknown

  # @!attribute top_k
  #   The number of results to return.
  #
  #   @return [Integer, nil]
  optional :top_k, Integer

  # @!method initialize(aggregate_by: nil, distance_metric: nil, exclude_attributes: nil, filters: nil, group_by: nil, include_attributes: nil, limit: nil, rank_by: nil, top_k: nil)
  #   Some parameter documentations has been truncated, see
  #   {Turbopuffer::Models::NamespaceMultiQueryParams::Query} for more details.
  #
  #   Query, filter, full-text search and vector search documents.
  #
  #   @param aggregate_by [Hash{Symbol=>Object}] Aggregations to compute over all documents in the namespace that match the filte
  #
  #   @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
  #
  #   @param exclude_attributes [Array<String>] List of attribute names to exclude from the response. All other attributes will
  #
  #   @param filters [Object] Exact filters for attributes to refine search results for. Think of it as a SQL
  #
  #   @param group_by [Array<String>] Groups documents by the specified attributes (the "group key") before computing
  #
  #   @param include_attributes [Boolean, Array<String>] Whether to include attributes in the response.
  #
  #   @param limit [Integer, Turbopuffer::Models::Limit] Limits the documents returned by a query.
  #
  #   @param rank_by [Object] How to rank the documents in the namespace.
  #
  #   @param top_k [Integer] The number of results to return.

  # Limits the documents returned by a query.
  #
  # @see Turbopuffer::Models::NamespaceMultiQueryParams::Query#limit
  module Limit
    extend Turbopuffer::Internal::Type::Union

    variant Integer

    # Limits the documents returned by a query.
    variant -> { Turbopuffer::Limit }

    # @!method self.variants
    #   @return [Array(Integer, Turbopuffer::Models::Limit)]
  end
end

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)


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

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

#distance_metricSymbol, ...

A function used to calculate vector similarity.

Returns:



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

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)


63
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 63

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)


70
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 70

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)


77
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 77

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

#include_attributesBoolean, ...

Whether to include attributes in the response.

Returns:

  • (Boolean, Array<String>, nil)


83
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 83

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

#limitInteger, ...

Limits the documents returned by a query.

Returns:



89
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 89

optional :limit, union: -> { Turbopuffer::NamespaceMultiQueryParams::Query::Limit }

#rank_byObject?

How to rank the documents in the namespace.

Returns:

  • (Object, nil)


95
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 95

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

#top_kInteger?

The number of results to return.

Returns:

  • (Integer, nil)


101
# File 'lib/turbopuffer/models/namespace_multi_query_params.rb', line 101

optional :top_k, Integer