Class Query (2.24.1)

public final class Query extends GeneratedMessageV3 implements QueryOrBuilder

A query for entities.

The query stages are executed in the following order:

  1. kind
  2. filter
  3. projection
  4. order + start_cursor + end_cursor
  5. offset
  6. limit
  7. find_nearest

Protobuf type google.datastore.v1.Query

Implements

QueryOrBuilder

Static Fields

DISTINCT_ON_FIELD_NUMBER

public static final int DISTINCT_ON_FIELD_NUMBER
Field Value
Type Description
int

END_CURSOR_FIELD_NUMBER

public static final int END_CURSOR_FIELD_NUMBER
Field Value
Type Description
int

FILTER_FIELD_NUMBER

public static final int FILTER_FIELD_NUMBER
Field Value
Type Description
int

FIND_NEAREST_FIELD_NUMBER

public static final int FIND_NEAREST_FIELD_NUMBER
Field Value
Type Description
int

KIND_FIELD_NUMBER

public static final int KIND_FIELD_NUMBER
Field Value
Type Description
int

LIMIT_FIELD_NUMBER

public static final int LIMIT_FIELD_NUMBER
Field Value
Type Description
int

OFFSET_FIELD_NUMBER

public static final int OFFSET_FIELD_NUMBER
Field Value
Type Description
int

ORDER_FIELD_NUMBER

public static final int ORDER_FIELD_NUMBER
Field Value
Type Description
int

PROJECTION_FIELD_NUMBER

public static final int PROJECTION_FIELD_NUMBER
Field Value
Type Description
int

START_CURSOR_FIELD_NUMBER

public static final int START_CURSOR_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static Query getDefaultInstance()
Returns
Type Description
Query

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static Query.Builder newBuilder()
Returns
Type Description
Query.Builder

newBuilder(Query prototype)

public static Query.Builder newBuilder(Query prototype)
Parameter
Name Description
prototype Query
Returns
Type Description
Query.Builder

parseDelimitedFrom(InputStream input)

public static Query parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Query parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static Query parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Query parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Query parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Query parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Query parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Query parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static Query parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Query parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static Query parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Query parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
Query
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<Query> parser()
Returns
Type Description
Parser<Query>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getDefaultInstanceForType()

public Query getDefaultInstanceForType()
Returns
Type Description
Query

getDistinctOn(int index)

public PropertyReference getDistinctOn(int index)

The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

Requires:

  • If order is specified, the set of distinct on properties must appear before the non-distinct on properties in order.

repeated .google.datastore.v1.PropertyReference distinct_on = 6;

Parameter
Name Description
index int
Returns
Type Description
PropertyReference

getDistinctOnCount()

public int getDistinctOnCount()

The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

Requires:

  • If order is specified, the set of distinct on properties must appear before the non-distinct on properties in order.

repeated .google.datastore.v1.PropertyReference distinct_on = 6;

Returns
Type Description
int

getDistinctOnList()

public List<PropertyReference> getDistinctOnList()

The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

Requires:

  • If order is specified, the set of distinct on properties must appear before the non-distinct on properties in order.

repeated .google.datastore.v1.PropertyReference distinct_on = 6;

Returns
Type Description
List<PropertyReference>

getDistinctOnOrBuilder(int index)

public PropertyReferenceOrBuilder getDistinctOnOrBuilder(int index)

The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

Requires:

  • If order is specified, the set of distinct on properties must appear before the non-distinct on properties in order.

repeated .google.datastore.v1.PropertyReference distinct_on = 6;

Parameter
Name Description
index int
Returns
Type Description
PropertyReferenceOrBuilder

getDistinctOnOrBuilderList()

public List<? extends PropertyReferenceOrBuilder> getDistinctOnOrBuilderList()

The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given properties (if empty, all results are returned).

Requires:

  • If order is specified, the set of distinct on properties must appear before the non-distinct on properties in order.

repeated .google.datastore.v1.PropertyReference distinct_on = 6;

Returns
Type Description
List<? extends com.google.datastore.v1.PropertyReferenceOrBuilder>

getEndCursor()

public ByteString getEndCursor()

An ending point for the query results. Query cursors are returned in query result batches and can only be used to limit the same query.

bytes end_cursor = 8;

Returns
Type Description
ByteString

The endCursor.

getFilter()

public Filter getFilter()

The filter to apply.

.google.datastore.v1.Filter filter = 4;

Returns
Type Description
Filter

The filter.

getFilterOrBuilder()

public FilterOrBuilder getFilterOrBuilder()

The filter to apply.

.google.datastore.v1.Filter filter = 4;

Returns
Type Description
FilterOrBuilder

getFindNearest()

public FindNearest getFindNearest()

Optional. A potential Nearest Neighbors Search.

Applies after all other filters and ordering.

Finds the closest vector embeddings to the given query vector.

.google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
FindNearest

The findNearest.

getFindNearestOrBuilder()

public FindNearestOrBuilder getFindNearestOrBuilder()

Optional. A potential Nearest Neighbors Search.

Applies after all other filters and ordering.

Finds the closest vector embeddings to the given query vector.

.google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
FindNearestOrBuilder

getKind(int index)

public KindExpression getKind(int index)

The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

repeated .google.datastore.v1.KindExpression kind = 3;

Parameter
Name Description
index int
Returns
Type Description
KindExpression

getKindCount()

public int getKindCount()

The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

repeated .google.datastore.v1.KindExpression kind = 3;

Returns
Type Description
int

getKindList()

public List<KindExpression> getKindList()

The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

repeated .google.datastore.v1.KindExpression kind = 3;

Returns
Type Description
List<KindExpression>

getKindOrBuilder(int index)

public KindExpressionOrBuilder getKindOrBuilder(int index)

The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

repeated .google.datastore.v1.KindExpression kind = 3;

Parameter
Name Description
index int
Returns
Type Description
KindExpressionOrBuilder

getKindOrBuilderList()

public List<? extends KindExpressionOrBuilder> getKindOrBuilderList()

The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified.

repeated .google.datastore.v1.KindExpression kind = 3;

Returns
Type Description
List<? extends com.google.datastore.v1.KindExpressionOrBuilder>

getLimit()

public Int32Value getLimit()

The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.

.google.protobuf.Int32Value limit = 12;

Returns
Type Description
Int32Value

The limit.

getLimitOrBuilder()

public Int32ValueOrBuilder getLimitOrBuilder()

The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.

.google.protobuf.Int32Value limit = 12;

Returns
Type Description
Int32ValueOrBuilder

getOffset()

public int getOffset()

The number of results to skip. Applies before limit, but after all other constraints. Optional. Must be >= 0 if specified.

int32 offset = 10;

Returns
Type Description
int

The offset.

getOrder(int index)

public PropertyOrder getOrder(int index)

The order to apply to the query results (if empty, order is unspecified).

repeated .google.datastore.v1.PropertyOrder order = 5;

Parameter
Name Description
index int
Returns
Type Description
PropertyOrder

getOrderCount()

public int getOrderCount()

The order to apply to the query results (if empty, order is unspecified).

repeated .google.datastore.v1.PropertyOrder order = 5;

Returns
Type Description
int

getOrderList()

public List<PropertyOrder> getOrderList()

The order to apply to the query results (if empty, order is unspecified).

repeated .google.datastore.v1.PropertyOrder order = 5;

Returns
Type Description
List<PropertyOrder>

getOrderOrBuilder(int index)

public PropertyOrderOrBuilder getOrderOrBuilder(int index)

The order to apply to the query results (if empty, order is unspecified).

repeated .google.datastore.v1.PropertyOrder order = 5;

Parameter
Name Description
index int
Returns
Type Description
PropertyOrderOrBuilder

getOrderOrBuilderList()

public List<? extends PropertyOrderOrBuilder> getOrderOrBuilderList()

The order to apply to the query results (if empty, order is unspecified).

repeated .google.datastore.v1.PropertyOrder order = 5;

Returns
Type Description
List<? extends com.google.datastore.v1.PropertyOrderOrBuilder>

getParserForType()

public Parser<Query> getParserForType()
Returns
Type Description
Parser<Query>
Overrides

getProjection(int index)

public Projection getProjection(int index)

The projection to return. Defaults to returning all properties.

repeated .google.datastore.v1.Projection projection = 2;

Parameter
Name Description
index int
Returns
Type Description
Projection

getProjectionCount()

public int getProjectionCount()

The projection to return. Defaults to returning all properties.

repeated .google.datastore.v1.Projection projection = 2;

Returns
Type Description
int

getProjectionList()

public List<Projection> getProjectionList()

The projection to return. Defaults to returning all properties.

repeated .google.datastore.v1.Projection projection = 2;

Returns
Type Description
List<Projection>

getProjectionOrBuilder(int index)

public ProjectionOrBuilder getProjectionOrBuilder(int index)

The projection to return. Defaults to returning all properties.

repeated .google.datastore.v1.Projection projection = 2;

Parameter
Name Description
index int
Returns
Type Description
ProjectionOrBuilder

getProjectionOrBuilderList()

public List<? extends ProjectionOrBuilder> getProjectionOrBuilderList()

The projection to return. Defaults to returning all properties.

repeated .google.datastore.v1.Projection projection = 2;

Returns
Type Description
List<? extends com.google.datastore.v1.ProjectionOrBuilder>

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getStartCursor()

public ByteString getStartCursor()

A starting point for the query results. Query cursors are returned in query result batches and can only be used to continue the same query.

bytes start_cursor = 7;

Returns
Type Description
ByteString

The startCursor.

hasFilter()

public boolean hasFilter()

The filter to apply.

.google.datastore.v1.Filter filter = 4;

Returns
Type Description
boolean

Whether the filter field is set.

hasFindNearest()

public boolean hasFindNearest()

Optional. A potential Nearest Neighbors Search.

Applies after all other filters and ordering.

Finds the closest vector embeddings to the given query vector.

.google.datastore.v1.FindNearest find_nearest = 13 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the findNearest field is set.

hasLimit()

public boolean hasLimit()

The maximum number of results to return. Applies after all other constraints. Optional. Unspecified is interpreted as no limit. Must be >= 0 if specified.

.google.protobuf.Int32Value limit = 12;

Returns
Type Description
boolean

Whether the limit field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public Query.Builder newBuilderForType()
Returns
Type Description
Query.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Query.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
Query.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public Query.Builder toBuilder()
Returns
Type Description
Query.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException