com.yelp.nrtsearch.server.grpc.KnnQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clientlib Show documentation
Show all versions of clientlib Show documentation
GRPC Clientlib for nrtSearch
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: yelp/nrtsearch/search.proto
// Protobuf Java Version: 3.25.3
package com.yelp.nrtsearch.server.grpc;
/**
*
* Specification for kNN vector search query
*
*
* Protobuf type {@code luceneserver.KnnQuery}
*/
public final class KnnQuery extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:luceneserver.KnnQuery)
KnnQueryOrBuilder {
private static final long serialVersionUID = 0L;
// Use KnnQuery.newBuilder() to construct.
private KnnQuery(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private KnnQuery() {
field_ = "";
queryVector_ = emptyFloatList();
queryByteVector_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new KnnQuery();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.yelp.nrtsearch.server.grpc.SearchResponseProto.internal_static_luceneserver_KnnQuery_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.yelp.nrtsearch.server.grpc.SearchResponseProto.internal_static_luceneserver_KnnQuery_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.yelp.nrtsearch.server.grpc.KnnQuery.class, com.yelp.nrtsearch.server.grpc.KnnQuery.Builder.class);
}
private int bitField0_;
public static final int FIELD_FIELD_NUMBER = 1;
@SuppressWarnings("serial")
private volatile java.lang.Object field_ = "";
/**
*
* Vector field name
*
*
* string field = 1;
* @return The field.
*/
@java.lang.Override
public java.lang.String getField() {
java.lang.Object ref = field_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
field_ = s;
return s;
}
}
/**
*
* Vector field name
*
*
* string field = 1;
* @return The bytes for field.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getFieldBytes() {
java.lang.Object ref = field_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
field_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int FILTER_FIELD_NUMBER = 2;
private com.yelp.nrtsearch.server.grpc.Query filter_;
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
* @return Whether the filter field is set.
*/
@java.lang.Override
public boolean hasFilter() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
* @return The filter.
*/
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.Query getFilter() {
return filter_ == null ? com.yelp.nrtsearch.server.grpc.Query.getDefaultInstance() : filter_;
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.QueryOrBuilder getFilterOrBuilder() {
return filter_ == null ? com.yelp.nrtsearch.server.grpc.Query.getDefaultInstance() : filter_;
}
public static final int K_FIELD_NUMBER = 3;
private int k_ = 0;
/**
*
* Number of top nearest neighbor documents to collect, must be <= num_candidates
*
*
* int32 k = 3;
* @return The k.
*/
@java.lang.Override
public int getK() {
return k_;
}
public static final int NUM_CANDIDATES_FIELD_NUMBER = 4;
private int numCandidates_ = 0;
/**
*
* Number of nearest neighbors to consider per segment. A larger value produces a more accurate top k. Must be <= 10000.
*
*
* int32 num_candidates = 4;
* @return The numCandidates.
*/
@java.lang.Override
public int getNumCandidates() {
return numCandidates_;
}
public static final int QUERY_VECTOR_FIELD_NUMBER = 5;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.FloatList queryVector_ =
emptyFloatList();
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @return A list containing the queryVector.
*/
@java.lang.Override
public java.util.List
getQueryVectorList() {
return queryVector_;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @return The count of queryVector.
*/
public int getQueryVectorCount() {
return queryVector_.size();
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @param index The index of the element to return.
* @return The queryVector at the given index.
*/
public float getQueryVector(int index) {
return queryVector_.getFloat(index);
}
private int queryVectorMemoizedSerializedSize = -1;
public static final int QUERY_BYTE_VECTOR_FIELD_NUMBER = 6;
private com.google.protobuf.ByteString queryByteVector_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* Vector value to use for query vector, for fields with byte element type
*
*
* bytes query_byte_vector = 6;
* @return The queryByteVector.
*/
@java.lang.Override
public com.google.protobuf.ByteString getQueryByteVector() {
return queryByteVector_;
}
public static final int BOOST_FIELD_NUMBER = 7;
private float boost_ = 0F;
/**
*
* Boost multiplier for similarity score
*
*
* float boost = 7;
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(field_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, field_);
}
if (((bitField0_ & 0x00000001) != 0)) {
output.writeMessage(2, getFilter());
}
if (k_ != 0) {
output.writeInt32(3, k_);
}
if (numCandidates_ != 0) {
output.writeInt32(4, numCandidates_);
}
if (getQueryVectorList().size() > 0) {
output.writeUInt32NoTag(42);
output.writeUInt32NoTag(queryVectorMemoizedSerializedSize);
}
for (int i = 0; i < queryVector_.size(); i++) {
output.writeFloatNoTag(queryVector_.getFloat(i));
}
if (!queryByteVector_.isEmpty()) {
output.writeBytes(6, queryByteVector_);
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
output.writeFloat(7, boost_);
}
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(field_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, field_);
}
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getFilter());
}
if (k_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(3, k_);
}
if (numCandidates_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(4, numCandidates_);
}
{
int dataSize = 0;
dataSize = 4 * getQueryVectorList().size();
size += dataSize;
if (!getQueryVectorList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
queryVectorMemoizedSerializedSize = dataSize;
}
if (!queryByteVector_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(6, queryByteVector_);
}
if (java.lang.Float.floatToRawIntBits(boost_) != 0) {
size += com.google.protobuf.CodedOutputStream
.computeFloatSize(7, boost_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.yelp.nrtsearch.server.grpc.KnnQuery)) {
return super.equals(obj);
}
com.yelp.nrtsearch.server.grpc.KnnQuery other = (com.yelp.nrtsearch.server.grpc.KnnQuery) obj;
if (!getField()
.equals(other.getField())) return false;
if (hasFilter() != other.hasFilter()) return false;
if (hasFilter()) {
if (!getFilter()
.equals(other.getFilter())) return false;
}
if (getK()
!= other.getK()) return false;
if (getNumCandidates()
!= other.getNumCandidates()) return false;
if (!getQueryVectorList()
.equals(other.getQueryVectorList())) return false;
if (!getQueryByteVector()
.equals(other.getQueryByteVector())) return false;
if (java.lang.Float.floatToIntBits(getBoost())
!= java.lang.Float.floatToIntBits(
other.getBoost())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + FIELD_FIELD_NUMBER;
hash = (53 * hash) + getField().hashCode();
if (hasFilter()) {
hash = (37 * hash) + FILTER_FIELD_NUMBER;
hash = (53 * hash) + getFilter().hashCode();
}
hash = (37 * hash) + K_FIELD_NUMBER;
hash = (53 * hash) + getK();
hash = (37 * hash) + NUM_CANDIDATES_FIELD_NUMBER;
hash = (53 * hash) + getNumCandidates();
if (getQueryVectorCount() > 0) {
hash = (37 * hash) + QUERY_VECTOR_FIELD_NUMBER;
hash = (53 * hash) + getQueryVectorList().hashCode();
}
hash = (37 * hash) + QUERY_BYTE_VECTOR_FIELD_NUMBER;
hash = (53 * hash) + getQueryByteVector().hashCode();
hash = (37 * hash) + BOOST_FIELD_NUMBER;
hash = (53 * hash) + java.lang.Float.floatToIntBits(
getBoost());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.yelp.nrtsearch.server.grpc.KnnQuery prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* Specification for kNN vector search query
*
*
* Protobuf type {@code luceneserver.KnnQuery}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:luceneserver.KnnQuery)
com.yelp.nrtsearch.server.grpc.KnnQueryOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.yelp.nrtsearch.server.grpc.SearchResponseProto.internal_static_luceneserver_KnnQuery_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.yelp.nrtsearch.server.grpc.SearchResponseProto.internal_static_luceneserver_KnnQuery_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.yelp.nrtsearch.server.grpc.KnnQuery.class, com.yelp.nrtsearch.server.grpc.KnnQuery.Builder.class);
}
// Construct using com.yelp.nrtsearch.server.grpc.KnnQuery.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
getFilterFieldBuilder();
}
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
field_ = "";
filter_ = null;
if (filterBuilder_ != null) {
filterBuilder_.dispose();
filterBuilder_ = null;
}
k_ = 0;
numCandidates_ = 0;
queryVector_ = emptyFloatList();
queryByteVector_ = com.google.protobuf.ByteString.EMPTY;
boost_ = 0F;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.yelp.nrtsearch.server.grpc.SearchResponseProto.internal_static_luceneserver_KnnQuery_descriptor;
}
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.KnnQuery getDefaultInstanceForType() {
return com.yelp.nrtsearch.server.grpc.KnnQuery.getDefaultInstance();
}
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.KnnQuery build() {
com.yelp.nrtsearch.server.grpc.KnnQuery result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.KnnQuery buildPartial() {
com.yelp.nrtsearch.server.grpc.KnnQuery result = new com.yelp.nrtsearch.server.grpc.KnnQuery(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(com.yelp.nrtsearch.server.grpc.KnnQuery result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.field_ = field_;
}
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000002) != 0)) {
result.filter_ = filterBuilder_ == null
? filter_
: filterBuilder_.build();
to_bitField0_ |= 0x00000001;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.k_ = k_;
}
if (((from_bitField0_ & 0x00000008) != 0)) {
result.numCandidates_ = numCandidates_;
}
if (((from_bitField0_ & 0x00000010) != 0)) {
queryVector_.makeImmutable();
result.queryVector_ = queryVector_;
}
if (((from_bitField0_ & 0x00000020) != 0)) {
result.queryByteVector_ = queryByteVector_;
}
if (((from_bitField0_ & 0x00000040) != 0)) {
result.boost_ = boost_;
}
result.bitField0_ |= to_bitField0_;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.yelp.nrtsearch.server.grpc.KnnQuery) {
return mergeFrom((com.yelp.nrtsearch.server.grpc.KnnQuery)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.yelp.nrtsearch.server.grpc.KnnQuery other) {
if (other == com.yelp.nrtsearch.server.grpc.KnnQuery.getDefaultInstance()) return this;
if (!other.getField().isEmpty()) {
field_ = other.field_;
bitField0_ |= 0x00000001;
onChanged();
}
if (other.hasFilter()) {
mergeFilter(other.getFilter());
}
if (other.getK() != 0) {
setK(other.getK());
}
if (other.getNumCandidates() != 0) {
setNumCandidates(other.getNumCandidates());
}
if (!other.queryVector_.isEmpty()) {
if (queryVector_.isEmpty()) {
queryVector_ = other.queryVector_;
queryVector_.makeImmutable();
bitField0_ |= 0x00000010;
} else {
ensureQueryVectorIsMutable();
queryVector_.addAll(other.queryVector_);
}
onChanged();
}
if (other.getQueryByteVector() != com.google.protobuf.ByteString.EMPTY) {
setQueryByteVector(other.getQueryByteVector());
}
if (other.getBoost() != 0F) {
setBoost(other.getBoost());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
field_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 18: {
input.readMessage(
getFilterFieldBuilder().getBuilder(),
extensionRegistry);
bitField0_ |= 0x00000002;
break;
} // case 18
case 24: {
k_ = input.readInt32();
bitField0_ |= 0x00000004;
break;
} // case 24
case 32: {
numCandidates_ = input.readInt32();
bitField0_ |= 0x00000008;
break;
} // case 32
case 45: {
float v = input.readFloat();
ensureQueryVectorIsMutable();
queryVector_.addFloat(v);
break;
} // case 45
case 42: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
int alloc = length > 4096 ? 4096 : length;
ensureQueryVectorIsMutable(alloc / 4);
while (input.getBytesUntilLimit() > 0) {
queryVector_.addFloat(input.readFloat());
}
input.popLimit(limit);
break;
} // case 42
case 50: {
queryByteVector_ = input.readBytes();
bitField0_ |= 0x00000020;
break;
} // case 50
case 61: {
boost_ = input.readFloat();
bitField0_ |= 0x00000040;
break;
} // case 61
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object field_ = "";
/**
*
* Vector field name
*
*
* string field = 1;
* @return The field.
*/
public java.lang.String getField() {
java.lang.Object ref = field_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
field_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* Vector field name
*
*
* string field = 1;
* @return The bytes for field.
*/
public com.google.protobuf.ByteString
getFieldBytes() {
java.lang.Object ref = field_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
field_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* Vector field name
*
*
* string field = 1;
* @param value The field to set.
* @return This builder for chaining.
*/
public Builder setField(
java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
field_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
* Vector field name
*
*
* string field = 1;
* @return This builder for chaining.
*/
public Builder clearField() {
field_ = getDefaultInstance().getField();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
* Vector field name
*
*
* string field = 1;
* @param value The bytes for field to set.
* @return This builder for chaining.
*/
public Builder setFieldBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
checkByteStringIsUtf8(value);
field_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
private com.yelp.nrtsearch.server.grpc.Query filter_;
private com.google.protobuf.SingleFieldBuilderV3<
com.yelp.nrtsearch.server.grpc.Query, com.yelp.nrtsearch.server.grpc.Query.Builder, com.yelp.nrtsearch.server.grpc.QueryOrBuilder> filterBuilder_;
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
* @return Whether the filter field is set.
*/
public boolean hasFilter() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
* @return The filter.
*/
public com.yelp.nrtsearch.server.grpc.Query getFilter() {
if (filterBuilder_ == null) {
return filter_ == null ? com.yelp.nrtsearch.server.grpc.Query.getDefaultInstance() : filter_;
} else {
return filterBuilder_.getMessage();
}
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public Builder setFilter(com.yelp.nrtsearch.server.grpc.Query value) {
if (filterBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
filter_ = value;
} else {
filterBuilder_.setMessage(value);
}
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public Builder setFilter(
com.yelp.nrtsearch.server.grpc.Query.Builder builderForValue) {
if (filterBuilder_ == null) {
filter_ = builderForValue.build();
} else {
filterBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public Builder mergeFilter(com.yelp.nrtsearch.server.grpc.Query value) {
if (filterBuilder_ == null) {
if (((bitField0_ & 0x00000002) != 0) &&
filter_ != null &&
filter_ != com.yelp.nrtsearch.server.grpc.Query.getDefaultInstance()) {
getFilterBuilder().mergeFrom(value);
} else {
filter_ = value;
}
} else {
filterBuilder_.mergeFrom(value);
}
if (filter_ != null) {
bitField0_ |= 0x00000002;
onChanged();
}
return this;
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public Builder clearFilter() {
bitField0_ = (bitField0_ & ~0x00000002);
filter_ = null;
if (filterBuilder_ != null) {
filterBuilder_.dispose();
filterBuilder_ = null;
}
onChanged();
return this;
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public com.yelp.nrtsearch.server.grpc.Query.Builder getFilterBuilder() {
bitField0_ |= 0x00000002;
onChanged();
return getFilterFieldBuilder().getBuilder();
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
public com.yelp.nrtsearch.server.grpc.QueryOrBuilder getFilterOrBuilder() {
if (filterBuilder_ != null) {
return filterBuilder_.getMessageOrBuilder();
} else {
return filter_ == null ?
com.yelp.nrtsearch.server.grpc.Query.getDefaultInstance() : filter_;
}
}
/**
*
* Query used to filter vector search, or unset for no filter
*
*
* .luceneserver.Query filter = 2;
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.yelp.nrtsearch.server.grpc.Query, com.yelp.nrtsearch.server.grpc.Query.Builder, com.yelp.nrtsearch.server.grpc.QueryOrBuilder>
getFilterFieldBuilder() {
if (filterBuilder_ == null) {
filterBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.yelp.nrtsearch.server.grpc.Query, com.yelp.nrtsearch.server.grpc.Query.Builder, com.yelp.nrtsearch.server.grpc.QueryOrBuilder>(
getFilter(),
getParentForChildren(),
isClean());
filter_ = null;
}
return filterBuilder_;
}
private int k_ ;
/**
*
* Number of top nearest neighbor documents to collect, must be <= num_candidates
*
*
* int32 k = 3;
* @return The k.
*/
@java.lang.Override
public int getK() {
return k_;
}
/**
*
* Number of top nearest neighbor documents to collect, must be <= num_candidates
*
*
* int32 k = 3;
* @param value The k to set.
* @return This builder for chaining.
*/
public Builder setK(int value) {
k_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* Number of top nearest neighbor documents to collect, must be <= num_candidates
*
*
* int32 k = 3;
* @return This builder for chaining.
*/
public Builder clearK() {
bitField0_ = (bitField0_ & ~0x00000004);
k_ = 0;
onChanged();
return this;
}
private int numCandidates_ ;
/**
*
* Number of nearest neighbors to consider per segment. A larger value produces a more accurate top k. Must be <= 10000.
*
*
* int32 num_candidates = 4;
* @return The numCandidates.
*/
@java.lang.Override
public int getNumCandidates() {
return numCandidates_;
}
/**
*
* Number of nearest neighbors to consider per segment. A larger value produces a more accurate top k. Must be <= 10000.
*
*
* int32 num_candidates = 4;
* @param value The numCandidates to set.
* @return This builder for chaining.
*/
public Builder setNumCandidates(int value) {
numCandidates_ = value;
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* Number of nearest neighbors to consider per segment. A larger value produces a more accurate top k. Must be <= 10000.
*
*
* int32 num_candidates = 4;
* @return This builder for chaining.
*/
public Builder clearNumCandidates() {
bitField0_ = (bitField0_ & ~0x00000008);
numCandidates_ = 0;
onChanged();
return this;
}
private com.google.protobuf.Internal.FloatList queryVector_ = emptyFloatList();
private void ensureQueryVectorIsMutable() {
if (!queryVector_.isModifiable()) {
queryVector_ = makeMutableCopy(queryVector_);
}
bitField0_ |= 0x00000010;
}
private void ensureQueryVectorIsMutable(int capacity) {
if (!queryVector_.isModifiable()) {
queryVector_ = makeMutableCopy(queryVector_, capacity);
}
bitField0_ |= 0x00000010;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @return A list containing the queryVector.
*/
public java.util.List
getQueryVectorList() {
queryVector_.makeImmutable();
return queryVector_;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @return The count of queryVector.
*/
public int getQueryVectorCount() {
return queryVector_.size();
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @param index The index of the element to return.
* @return The queryVector at the given index.
*/
public float getQueryVector(int index) {
return queryVector_.getFloat(index);
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @param index The index to set the value at.
* @param value The queryVector to set.
* @return This builder for chaining.
*/
public Builder setQueryVector(
int index, float value) {
ensureQueryVectorIsMutable();
queryVector_.setFloat(index, value);
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @param value The queryVector to add.
* @return This builder for chaining.
*/
public Builder addQueryVector(float value) {
ensureQueryVectorIsMutable();
queryVector_.addFloat(value);
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @param values The queryVector to add.
* @return This builder for chaining.
*/
public Builder addAllQueryVector(
java.lang.Iterable extends java.lang.Float> values) {
ensureQueryVectorIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, queryVector_);
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
*
* Vector value to use for query vector, for fields with float element type
*
*
* repeated float query_vector = 5;
* @return This builder for chaining.
*/
public Builder clearQueryVector() {
queryVector_ = emptyFloatList();
bitField0_ = (bitField0_ & ~0x00000010);
onChanged();
return this;
}
private com.google.protobuf.ByteString queryByteVector_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* Vector value to use for query vector, for fields with byte element type
*
*
* bytes query_byte_vector = 6;
* @return The queryByteVector.
*/
@java.lang.Override
public com.google.protobuf.ByteString getQueryByteVector() {
return queryByteVector_;
}
/**
*
* Vector value to use for query vector, for fields with byte element type
*
*
* bytes query_byte_vector = 6;
* @param value The queryByteVector to set.
* @return This builder for chaining.
*/
public Builder setQueryByteVector(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
queryByteVector_ = value;
bitField0_ |= 0x00000020;
onChanged();
return this;
}
/**
*
* Vector value to use for query vector, for fields with byte element type
*
*
* bytes query_byte_vector = 6;
* @return This builder for chaining.
*/
public Builder clearQueryByteVector() {
bitField0_ = (bitField0_ & ~0x00000020);
queryByteVector_ = getDefaultInstance().getQueryByteVector();
onChanged();
return this;
}
private float boost_ ;
/**
*
* Boost multiplier for similarity score
*
*
* float boost = 7;
* @return The boost.
*/
@java.lang.Override
public float getBoost() {
return boost_;
}
/**
*
* Boost multiplier for similarity score
*
*
* float boost = 7;
* @param value The boost to set.
* @return This builder for chaining.
*/
public Builder setBoost(float value) {
boost_ = value;
bitField0_ |= 0x00000040;
onChanged();
return this;
}
/**
*
* Boost multiplier for similarity score
*
*
* float boost = 7;
* @return This builder for chaining.
*/
public Builder clearBoost() {
bitField0_ = (bitField0_ & ~0x00000040);
boost_ = 0F;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:luceneserver.KnnQuery)
}
// @@protoc_insertion_point(class_scope:luceneserver.KnnQuery)
private static final com.yelp.nrtsearch.server.grpc.KnnQuery DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.yelp.nrtsearch.server.grpc.KnnQuery();
}
public static com.yelp.nrtsearch.server.grpc.KnnQuery getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public KnnQuery parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public com.yelp.nrtsearch.server.grpc.KnnQuery getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}