Class: Google::Cloud::Firestore::V1::StructuredQuery
- Inherits:
-
Object
- Object
- Google::Cloud::Firestore::V1::StructuredQuery
- Extended by:
- Protobuf::MessageExts::ClassMethods
- Includes:
- Protobuf::MessageExts
- Defined in:
- proto_docs/google/firestore/v1/query.rb
Overview
A Firestore query.
The query stages are executed in the following order:
- from
- where
- select
- order_by + start_at + end_at
- offset
- limit
Defined Under Namespace
Modules: Direction Classes: CollectionSelector, CompositeFilter, FieldFilter, FieldReference, Filter, FindNearest, Order, Projection, UnaryFilter
Instance Attribute Summary collapse
-
#end_at ⇒ ::Google::Cloud::Firestore::V1::Cursor
A potential prefix of a position in the result set to end the query at.
-
#find_nearest ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest
Optional.
-
#from ⇒ ::Array<::Google::Cloud::Firestore::V1::StructuredQuery::CollectionSelector>
The collections to query.
-
#limit ⇒ ::Google::Protobuf::Int32Value
The maximum number of results to return.
-
#offset ⇒ ::Integer
The number of documents to skip before returning the first result.
-
#order_by ⇒ ::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Order>
The order to apply to the query results.
-
#select ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::Projection
Optional sub-set of the fields to return.
-
#start_at ⇒ ::Google::Cloud::Firestore::V1::Cursor
A potential prefix of a position in the result set to start the query at.
-
#where ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::Filter
The filter to apply.
Instance Attribute Details
#end_at ⇒ ::Google::Cloud::Firestore::V1::Cursor
Returns A potential prefix of a position in the result set to end the query at.
This is similar to START_AT
but with it controlling the end position
rather than the start position.
Requires:
- The number of values cannot be greater than the number of fields
specified in the
ORDER BY
clause.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#find_nearest ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest
Returns Optional. A potential nearest neighbors search.
Applies after all other filters and ordering.
Finds the closest vector embeddings to the given query vector.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#from ⇒ ::Array<::Google::Cloud::Firestore::V1::StructuredQuery::CollectionSelector>
Returns The collections to query.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#limit ⇒ ::Google::Protobuf::Int32Value
Returns The maximum number of results to return.
Applies after all other constraints.
Requires:
- The value must be greater than or equal to zero if specified.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#offset ⇒ ::Integer
Returns The number of documents to skip before returning the first result.
This applies after the constraints specified by the WHERE
, START AT
, &
END AT
but before the LIMIT
clause.
Requires:
- The value must be greater than or equal to zero if specified.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#order_by ⇒ ::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Order>
Returns The order to apply to the query results.
Firestore allows callers to provide a full ordering, a partial ordering, or no ordering at all. In all cases, Firestore guarantees a stable ordering through the following rules:
- The
order_by
is required to reference all fields used with an inequality filter. - All fields that are required to be in the
order_by
but are not already present are appended in lexicographical ordering of the field name. - If an order on
__name__
is not specified, it is appended by default.
Fields are appended with the same sort direction as the last order specified, or 'ASCENDING' if no order was specified. For example:
ORDER BY a
becomesORDER BY a ASC, __name__ ASC
ORDER BY a DESC
becomesORDER BY a DESC, __name__ DESC
WHERE a > 1
becomesWHERE a > 1 ORDER BY a ASC, __name__ ASC
WHERE __name__ > ... AND a > 1
becomesWHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC
.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#select ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::Projection
Returns Optional sub-set of the fields to return.
This acts as a DocumentMask over the documents returned from a query. When not set, assumes that the caller wants all fields returned.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#start_at ⇒ ::Google::Cloud::Firestore::V1::Cursor
Returns A potential prefix of a position in the result set to start the query at.
The ordering of the result set is based on the ORDER BY
clause of the
original query.
SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
This query's results are ordered by (b ASC, __name__ ASC)
.
Cursors can reference either the full ordering or a prefix of the location,
though it cannot reference more fields than what are in the provided
ORDER BY
.
Continuing off the example above, attaching the following start cursors will have varying impact:
START BEFORE (2, /k/123)
: start the query right beforea = 1 AND b > 2 AND __name__ > /k/123
.START AFTER (10)
: start the query right aftera = 1 AND b > 10
.
Unlike OFFSET
which requires scanning over the first N results to skip,
a start cursor allows the query to begin at a logical position. This
position is not required to match an actual result, it will scan forward
from this position to find the next document.
Requires:
- The number of values cannot be greater than the number of fields
specified in the
ORDER BY
clause.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |
#where ⇒ ::Google::Cloud::Firestore::V1::StructuredQuery::Filter
Returns The filter to apply.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'proto_docs/google/firestore/v1/query.rb', line 138 class StructuredQuery include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A selection of a collection, such as `messages as m1`. # @!attribute [rw] collection_id # @return [::String] # The collection ID. # When set, selects only collections with this ID. # @!attribute [rw] all_descendants # @return [::Boolean] # When false, selects only collections that are immediate children of # the `parent` specified in the containing `RunQueryRequest`. # When true, selects all descendant collections. class CollectionSelector include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter. # @!attribute [rw] composite_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter] # A composite filter. # @!attribute [rw] field_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter] # A filter on a document field. # @!attribute [rw] unary_filter # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter] # A filter that takes exactly one argument. class Filter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A filter that merges multiple other filters using the given operator. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::CompositeFilter::Operator] # The operator for combining multiple filters. # @!attribute [rw] filters # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::Filter>] # The list of filters to combine. # # Requires: # # * At least one filter is present. class CompositeFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A composite filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # Documents are required to satisfy all of the combined filters. AND = 1 # Documents are required to satisfy at least one of the combined filters. OR = 2 end end # A filter on a specific field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to filter by. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldFilter::Operator] # The operator to filter by. # @!attribute [rw] value # @return [::Google::Cloud::Firestore::V1::Value] # The value to compare to. class FieldFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A field filter operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is less than the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN = 1 # The given `field` is less than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. LESS_THAN_OR_EQUAL = 2 # The given `field` is greater than the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN = 3 # The given `field` is greater than or equal to the given `value`. # # Requires: # # * That `field` come first in `order_by`. GREATER_THAN_OR_EQUAL = 4 # The given `field` is equal to the given `value`. EQUAL = 5 # The given `field` is not equal to the given `value`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_EQUAL = 6 # The given `field` is an array that contains the given `value`. ARRAY_CONTAINS = 7 # The given `field` is equal to at least one value in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No `NOT_IN` filters in the same query. IN = 8 # The given `field` is an array that contains any of the values in the # given array. # # Requires: # # * That `value` is a non-empty `ArrayValue`, subject to disjunction # limits. # * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction. # * No `NOT_IN` filters in the same query. ARRAY_CONTAINS_ANY = 9 # The value of the `field` is not in the given array. # # Requires: # # * That `value` is a non-empty `ArrayValue` with at most 10 values. # * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`, # `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. NOT_IN = 10 end end # A filter with a single operand. # @!attribute [rw] op # @return [::Google::Cloud::Firestore::V1::StructuredQuery::UnaryFilter::Operator] # The unary operator to apply. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to which to apply the operator. class UnaryFilter include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # A unary operator. module Operator # Unspecified. This value must not be used. OPERATOR_UNSPECIFIED = 0 # The given `field` is equal to `NaN`. IS_NAN = 2 # The given `field` is equal to `NULL`. IS_NULL = 3 # The given `field` is not equal to `NaN`. # # Requires: # # * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NAN = 4 # The given `field` is not equal to `NULL`. # # Requires: # # * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`. # * That `field` comes first in the `order_by`. IS_NOT_NULL = 5 end end # An order on a field. # @!attribute [rw] field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # The field to order by. # @!attribute [rw] direction # @return [::Google::Cloud::Firestore::V1::StructuredQuery::Direction] # The direction to order by. Defaults to `ASCENDING`. class Order include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # A reference to a field in a document, ex: `stats.operations`. # @!attribute [rw] field_path # @return [::String] # A reference to a field in a document. # # Requires: # # * MUST be a dot-delimited (`.`) string of segments, where each segment # conforms to {::Google::Cloud::Firestore::V1::Document#fields document field name} # limitations. class FieldReference include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # The projection of document's fields to return. # @!attribute [rw] fields # @return [::Array<::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference>] # The fields to return. # # If empty, all fields are returned. To only return the name # of the document, use `['__name__']`. class Projection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end # Nearest Neighbors search config. The ordering provided by FindNearest # supersedes the order_by stage. If multiple documents have the same vector # distance, the returned document order is not guaranteed to be stable # between queries. # @!attribute [rw] vector_field # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FieldReference] # Required. An indexed vector field to search upon. Only documents which # contain vectors whose dimensionality match the query_vector can be # returned. # @!attribute [rw] query_vector # @return [::Google::Cloud::Firestore::V1::Value] # Required. The query vector that we are searching on. Must be a vector of # no more than 2048 dimensions. # @!attribute [rw] distance_measure # @return [::Google::Cloud::Firestore::V1::StructuredQuery::FindNearest::DistanceMeasure] # Required. The distance measure to use, required. # @!attribute [rw] limit # @return [::Google::Protobuf::Int32Value] # Required. The number of nearest neighbors to return. Must be a positive # integer of no more than 1000. # @!attribute [rw] distance_result_field # @return [::String] # Optional. Optional name of the field to output the result of the vector # distance calculation. Must conform to [document field # name][google.firestore.v1.Document.fields] limitations. # @!attribute [rw] distance_threshold # @return [::Google::Protobuf::DoubleValue] # Optional. Option to specify a threshold for which no less similar # documents will be returned. The behavior of the specified # `distance_measure` will affect the meaning of the distance threshold. # Since DOT_PRODUCT distances increase when the vectors are more similar, # the comparison is inverted. # # For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold # For DOT_PRODUCT: WHERE distance >= distance_threshold class FindNearest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # The distance measure to use when comparing vectors. module DistanceMeasure # Should not be set. DISTANCE_MEASURE_UNSPECIFIED = 0 # Measures the EUCLIDEAN distance between the vectors. See # [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn # more. The resulting distance decreases the more similar two vectors # are. EUCLIDEAN = 1 # COSINE distance compares vectors based on the angle between them, which # allows you to measure similarity that isn't based on the vectors # magnitude. We recommend using DOT_PRODUCT with unit normalized vectors # instead of COSINE distance, which is mathematically equivalent with # better performance. See [Cosine # Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn # more about COSINE similarity and COSINE distance. The resulting # COSINE distance decreases the more similar two vectors are. COSINE = 2 # Similar to cosine but is affected by the magnitude of the vectors. See # [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more. # The resulting distance increases the more similar two vectors are. DOT_PRODUCT = 3 end end # A sort direction. module Direction # Unspecified. DIRECTION_UNSPECIFIED = 0 # Ascending. ASCENDING = 1 # Descending. DESCENDING = 2 end end |