/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/contentwarehouse/v1/document_service.proto

package com.google.cloud.contentwarehouse.v1;

/**
 *
 *
 * <pre>
 * Response message for DocumentService.SearchDocuments.
 * </pre>
 *
 * Protobuf type {@code google.cloud.contentwarehouse.v1.SearchDocumentsResponse}
 */
public final class SearchDocumentsResponse extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.SearchDocumentsResponse)
    SearchDocumentsResponseOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use SearchDocumentsResponse.newBuilder() to construct.
  private SearchDocumentsResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private SearchDocumentsResponse() {
    matchingDocuments_ = java.util.Collections.emptyList();
    nextPageToken_ = "";
    histogramQueryResults_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new SearchDocumentsResponse();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
        .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
        .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.class,
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.Builder.class);
  }

  public interface MatchingDocumentOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     *
     * @return Whether the document field is set.
     */
    boolean hasDocument();
    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     *
     * @return The document.
     */
    com.google.cloud.contentwarehouse.v1.Document getDocument();
    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     */
    com.google.cloud.contentwarehouse.v1.DocumentOrBuilder getDocumentOrBuilder();

    /**
     *
     *
     * <pre>
     * Contains snippets of text from the document full raw text that most
     * closely match a search query's keywords, if available. All HTML tags in
     * the original fields are stripped when returned in this field, and
     * matching query keywords are enclosed in HTML bold tags.
     * If the question-answering feature is enabled, this field will instead
     * contain a snippet that answers the user's natural-language query. No HTML
     * bold tags will be present, and highlights in the answer snippet can be
     * found in
     * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
     * </pre>
     *
     * <code>string search_text_snippet = 2;</code>
     *
     * @return The searchTextSnippet.
     */
    java.lang.String getSearchTextSnippet();
    /**
     *
     *
     * <pre>
     * Contains snippets of text from the document full raw text that most
     * closely match a search query's keywords, if available. All HTML tags in
     * the original fields are stripped when returned in this field, and
     * matching query keywords are enclosed in HTML bold tags.
     * If the question-answering feature is enabled, this field will instead
     * contain a snippet that answers the user's natural-language query. No HTML
     * bold tags will be present, and highlights in the answer snippet can be
     * found in
     * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
     * </pre>
     *
     * <code>string search_text_snippet = 2;</code>
     *
     * @return The bytes for searchTextSnippet.
     */
    com.google.protobuf.ByteString getSearchTextSnippetBytes();

    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     *
     * @return Whether the qaResult field is set.
     */
    boolean hasQaResult();
    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     *
     * @return The qaResult.
     */
    com.google.cloud.contentwarehouse.v1.QAResult getQaResult();
    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     */
    com.google.cloud.contentwarehouse.v1.QAResultOrBuilder getQaResultOrBuilder();
  }
  /**
   *
   *
   * <pre>
   * Document entry with metadata inside
   * [SearchDocumentsResponse][google.cloud.contentwarehouse.v1.SearchDocumentsResponse]
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument}
   */
  public static final class MatchingDocument extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
      MatchingDocumentOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use MatchingDocument.newBuilder() to construct.
    private MatchingDocument(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private MatchingDocument() {
      searchTextSnippet_ = "";
    }

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
      return new MatchingDocument();
    }

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
      return this.unknownFields;
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_MatchingDocument_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_MatchingDocument_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.class,
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
                  .class);
    }

    public static final int DOCUMENT_FIELD_NUMBER = 1;
    private com.google.cloud.contentwarehouse.v1.Document document_;
    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     *
     * @return Whether the document field is set.
     */
    @java.lang.Override
    public boolean hasDocument() {
      return document_ != null;
    }
    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     *
     * @return The document.
     */
    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.Document getDocument() {
      return document_ == null
          ? com.google.cloud.contentwarehouse.v1.Document.getDefaultInstance()
          : document_;
    }
    /**
     *
     *
     * <pre>
     * Document that matches the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * This document only contains indexed metadata information.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
     */
    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.DocumentOrBuilder getDocumentOrBuilder() {
      return document_ == null
          ? com.google.cloud.contentwarehouse.v1.Document.getDefaultInstance()
          : document_;
    }

    public static final int SEARCH_TEXT_SNIPPET_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private volatile java.lang.Object searchTextSnippet_ = "";
    /**
     *
     *
     * <pre>
     * Contains snippets of text from the document full raw text that most
     * closely match a search query's keywords, if available. All HTML tags in
     * the original fields are stripped when returned in this field, and
     * matching query keywords are enclosed in HTML bold tags.
     * If the question-answering feature is enabled, this field will instead
     * contain a snippet that answers the user's natural-language query. No HTML
     * bold tags will be present, and highlights in the answer snippet can be
     * found in
     * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
     * </pre>
     *
     * <code>string search_text_snippet = 2;</code>
     *
     * @return The searchTextSnippet.
     */
    @java.lang.Override
    public java.lang.String getSearchTextSnippet() {
      java.lang.Object ref = searchTextSnippet_;
      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();
        searchTextSnippet_ = s;
        return s;
      }
    }
    /**
     *
     *
     * <pre>
     * Contains snippets of text from the document full raw text that most
     * closely match a search query's keywords, if available. All HTML tags in
     * the original fields are stripped when returned in this field, and
     * matching query keywords are enclosed in HTML bold tags.
     * If the question-answering feature is enabled, this field will instead
     * contain a snippet that answers the user's natural-language query. No HTML
     * bold tags will be present, and highlights in the answer snippet can be
     * found in
     * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
     * </pre>
     *
     * <code>string search_text_snippet = 2;</code>
     *
     * @return The bytes for searchTextSnippet.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getSearchTextSnippetBytes() {
      java.lang.Object ref = searchTextSnippet_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        searchTextSnippet_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int QA_RESULT_FIELD_NUMBER = 3;
    private com.google.cloud.contentwarehouse.v1.QAResult qaResult_;
    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     *
     * @return Whether the qaResult field is set.
     */
    @java.lang.Override
    public boolean hasQaResult() {
      return qaResult_ != null;
    }
    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     *
     * @return The qaResult.
     */
    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.QAResult getQaResult() {
      return qaResult_ == null
          ? com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()
          : qaResult_;
    }
    /**
     *
     *
     * <pre>
     * Experimental.
     * Additional result info if the question-answering feature is enabled.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
     */
    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.QAResultOrBuilder getQaResultOrBuilder() {
      return qaResult_ == null
          ? com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()
          : qaResult_;
    }

    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 {
      if (document_ != null) {
        output.writeMessage(1, getDocument());
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(searchTextSnippet_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, searchTextSnippet_);
      }
      if (qaResult_ != null) {
        output.writeMessage(3, getQaResult());
      }
      getUnknownFields().writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (document_ != null) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument());
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(searchTextSnippet_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, searchTextSnippet_);
      }
      if (qaResult_ != null) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getQaResult());
      }
      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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)) {
        return super.equals(obj);
      }
      com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument other =
          (com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument) obj;

      if (hasDocument() != other.hasDocument()) return false;
      if (hasDocument()) {
        if (!getDocument().equals(other.getDocument())) return false;
      }
      if (!getSearchTextSnippet().equals(other.getSearchTextSnippet())) return false;
      if (hasQaResult() != other.hasQaResult()) return false;
      if (hasQaResult()) {
        if (!getQaResult().equals(other.getQaResult())) 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();
      if (hasDocument()) {
        hash = (37 * hash) + DOCUMENT_FIELD_NUMBER;
        hash = (53 * hash) + getDocument().hashCode();
      }
      hash = (37 * hash) + SEARCH_TEXT_SNIPPET_FIELD_NUMBER;
      hash = (53 * hash) + getSearchTextSnippet().hashCode();
      if (hasQaResult()) {
        hash = (37 * hash) + QA_RESULT_FIELD_NUMBER;
        hash = (53 * hash) + getQaResult().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(java.nio.ByteBuffer data)
            throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(
            java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(com.google.protobuf.ByteString data)
            throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(
            com.google.protobuf.ByteString data,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument 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;
    }
    /**
     *
     *
     * <pre>
     * Document entry with metadata inside
     * [SearchDocumentsResponse][google.cloud.contentwarehouse.v1.SearchDocumentsResponse]
     * </pre>
     *
     * Protobuf type {@code
     * google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocumentOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_MatchingDocument_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_MatchingDocument_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.class,
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
                    .Builder.class);
      }

      // Construct using
      // com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.newBuilder()
      private Builder() {}

      private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        document_ = null;
        if (documentBuilder_ != null) {
          documentBuilder_.dispose();
          documentBuilder_ = null;
        }
        searchTextSnippet_ = "";
        qaResult_ = null;
        if (qaResultBuilder_ != null) {
          qaResultBuilder_.dispose();
          qaResultBuilder_ = null;
        }
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
            .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_MatchingDocument_descriptor;
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
          getDefaultInstanceForType() {
        return com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
            .getDefaultInstance();
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument build() {
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument result =
            buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
          buildPartial() {
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument result =
            new com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument(this);
        if (bitField0_ != 0) {
          buildPartial0(result);
        }
        onBuilt();
        return result;
      }

      private void buildPartial0(
          com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.document_ = documentBuilder_ == null ? document_ : documentBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000002) != 0)) {
          result.searchTextSnippet_ = searchTextSnippet_;
        }
        if (((from_bitField0_ & 0x00000004) != 0)) {
          result.qaResult_ = qaResultBuilder_ == null ? qaResult_ : qaResultBuilder_.build();
        }
      }

      @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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument) {
          return mergeFrom(
              (com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
                  other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(
          com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument other) {
        if (other
            == com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
                .getDefaultInstance()) return this;
        if (other.hasDocument()) {
          mergeDocument(other.getDocument());
        }
        if (!other.getSearchTextSnippet().isEmpty()) {
          searchTextSnippet_ = other.searchTextSnippet_;
          bitField0_ |= 0x00000002;
          onChanged();
        }
        if (other.hasQaResult()) {
          mergeQaResult(other.getQaResult());
        }
        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:
                {
                  input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              case 18:
                {
                  searchTextSnippet_ = input.readStringRequireUtf8();
                  bitField0_ |= 0x00000002;
                  break;
                } // case 18
              case 26:
                {
                  input.readMessage(getQaResultFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000004;
                  break;
                } // case 26
              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 com.google.cloud.contentwarehouse.v1.Document document_;
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.contentwarehouse.v1.Document,
              com.google.cloud.contentwarehouse.v1.Document.Builder,
              com.google.cloud.contentwarehouse.v1.DocumentOrBuilder>
          documentBuilder_;
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       *
       * @return Whether the document field is set.
       */
      public boolean hasDocument() {
        return ((bitField0_ & 0x00000001) != 0);
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       *
       * @return The document.
       */
      public com.google.cloud.contentwarehouse.v1.Document getDocument() {
        if (documentBuilder_ == null) {
          return document_ == null
              ? com.google.cloud.contentwarehouse.v1.Document.getDefaultInstance()
              : document_;
        } else {
          return documentBuilder_.getMessage();
        }
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public Builder setDocument(com.google.cloud.contentwarehouse.v1.Document value) {
        if (documentBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          document_ = value;
        } else {
          documentBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public Builder setDocument(
          com.google.cloud.contentwarehouse.v1.Document.Builder builderForValue) {
        if (documentBuilder_ == null) {
          document_ = builderForValue.build();
        } else {
          documentBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public Builder mergeDocument(com.google.cloud.contentwarehouse.v1.Document value) {
        if (documentBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && document_ != null
              && document_ != com.google.cloud.contentwarehouse.v1.Document.getDefaultInstance()) {
            getDocumentBuilder().mergeFrom(value);
          } else {
            document_ = value;
          }
        } else {
          documentBuilder_.mergeFrom(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public Builder clearDocument() {
        bitField0_ = (bitField0_ & ~0x00000001);
        document_ = null;
        if (documentBuilder_ != null) {
          documentBuilder_.dispose();
          documentBuilder_ = null;
        }
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public com.google.cloud.contentwarehouse.v1.Document.Builder getDocumentBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return getDocumentFieldBuilder().getBuilder();
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      public com.google.cloud.contentwarehouse.v1.DocumentOrBuilder getDocumentOrBuilder() {
        if (documentBuilder_ != null) {
          return documentBuilder_.getMessageOrBuilder();
        } else {
          return document_ == null
              ? com.google.cloud.contentwarehouse.v1.Document.getDefaultInstance()
              : document_;
        }
      }
      /**
       *
       *
       * <pre>
       * Document that matches the specified
       * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
       * This document only contains indexed metadata information.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.Document document = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.contentwarehouse.v1.Document,
              com.google.cloud.contentwarehouse.v1.Document.Builder,
              com.google.cloud.contentwarehouse.v1.DocumentOrBuilder>
          getDocumentFieldBuilder() {
        if (documentBuilder_ == null) {
          documentBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.cloud.contentwarehouse.v1.Document,
                  com.google.cloud.contentwarehouse.v1.Document.Builder,
                  com.google.cloud.contentwarehouse.v1.DocumentOrBuilder>(
                  getDocument(), getParentForChildren(), isClean());
          document_ = null;
        }
        return documentBuilder_;
      }

      private java.lang.Object searchTextSnippet_ = "";
      /**
       *
       *
       * <pre>
       * Contains snippets of text from the document full raw text that most
       * closely match a search query's keywords, if available. All HTML tags in
       * the original fields are stripped when returned in this field, and
       * matching query keywords are enclosed in HTML bold tags.
       * If the question-answering feature is enabled, this field will instead
       * contain a snippet that answers the user's natural-language query. No HTML
       * bold tags will be present, and highlights in the answer snippet can be
       * found in
       * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
       * </pre>
       *
       * <code>string search_text_snippet = 2;</code>
       *
       * @return The searchTextSnippet.
       */
      public java.lang.String getSearchTextSnippet() {
        java.lang.Object ref = searchTextSnippet_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          searchTextSnippet_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * Contains snippets of text from the document full raw text that most
       * closely match a search query's keywords, if available. All HTML tags in
       * the original fields are stripped when returned in this field, and
       * matching query keywords are enclosed in HTML bold tags.
       * If the question-answering feature is enabled, this field will instead
       * contain a snippet that answers the user's natural-language query. No HTML
       * bold tags will be present, and highlights in the answer snippet can be
       * found in
       * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
       * </pre>
       *
       * <code>string search_text_snippet = 2;</code>
       *
       * @return The bytes for searchTextSnippet.
       */
      public com.google.protobuf.ByteString getSearchTextSnippetBytes() {
        java.lang.Object ref = searchTextSnippet_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          searchTextSnippet_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * Contains snippets of text from the document full raw text that most
       * closely match a search query's keywords, if available. All HTML tags in
       * the original fields are stripped when returned in this field, and
       * matching query keywords are enclosed in HTML bold tags.
       * If the question-answering feature is enabled, this field will instead
       * contain a snippet that answers the user's natural-language query. No HTML
       * bold tags will be present, and highlights in the answer snippet can be
       * found in
       * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
       * </pre>
       *
       * <code>string search_text_snippet = 2;</code>
       *
       * @param value The searchTextSnippet to set.
       * @return This builder for chaining.
       */
      public Builder setSearchTextSnippet(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }
        searchTextSnippet_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Contains snippets of text from the document full raw text that most
       * closely match a search query's keywords, if available. All HTML tags in
       * the original fields are stripped when returned in this field, and
       * matching query keywords are enclosed in HTML bold tags.
       * If the question-answering feature is enabled, this field will instead
       * contain a snippet that answers the user's natural-language query. No HTML
       * bold tags will be present, and highlights in the answer snippet can be
       * found in
       * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
       * </pre>
       *
       * <code>string search_text_snippet = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearSearchTextSnippet() {
        searchTextSnippet_ = getDefaultInstance().getSearchTextSnippet();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Contains snippets of text from the document full raw text that most
       * closely match a search query's keywords, if available. All HTML tags in
       * the original fields are stripped when returned in this field, and
       * matching query keywords are enclosed in HTML bold tags.
       * If the question-answering feature is enabled, this field will instead
       * contain a snippet that answers the user's natural-language query. No HTML
       * bold tags will be present, and highlights in the answer snippet can be
       * found in
       * [QAResult.highlights][google.cloud.contentwarehouse.v1.QAResult.highlights].
       * </pre>
       *
       * <code>string search_text_snippet = 2;</code>
       *
       * @param value The bytes for searchTextSnippet to set.
       * @return This builder for chaining.
       */
      public Builder setSearchTextSnippetBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);
        searchTextSnippet_ = value;
        bitField0_ |= 0x00000002;
        onChanged();
        return this;
      }

      private com.google.cloud.contentwarehouse.v1.QAResult qaResult_;
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.contentwarehouse.v1.QAResult,
              com.google.cloud.contentwarehouse.v1.QAResult.Builder,
              com.google.cloud.contentwarehouse.v1.QAResultOrBuilder>
          qaResultBuilder_;
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       *
       * @return Whether the qaResult field is set.
       */
      public boolean hasQaResult() {
        return ((bitField0_ & 0x00000004) != 0);
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       *
       * @return The qaResult.
       */
      public com.google.cloud.contentwarehouse.v1.QAResult getQaResult() {
        if (qaResultBuilder_ == null) {
          return qaResult_ == null
              ? com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()
              : qaResult_;
        } else {
          return qaResultBuilder_.getMessage();
        }
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public Builder setQaResult(com.google.cloud.contentwarehouse.v1.QAResult value) {
        if (qaResultBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          qaResult_ = value;
        } else {
          qaResultBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public Builder setQaResult(
          com.google.cloud.contentwarehouse.v1.QAResult.Builder builderForValue) {
        if (qaResultBuilder_ == null) {
          qaResult_ = builderForValue.build();
        } else {
          qaResultBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public Builder mergeQaResult(com.google.cloud.contentwarehouse.v1.QAResult value) {
        if (qaResultBuilder_ == null) {
          if (((bitField0_ & 0x00000004) != 0)
              && qaResult_ != null
              && qaResult_ != com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()) {
            getQaResultBuilder().mergeFrom(value);
          } else {
            qaResult_ = value;
          }
        } else {
          qaResultBuilder_.mergeFrom(value);
        }
        bitField0_ |= 0x00000004;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public Builder clearQaResult() {
        bitField0_ = (bitField0_ & ~0x00000004);
        qaResult_ = null;
        if (qaResultBuilder_ != null) {
          qaResultBuilder_.dispose();
          qaResultBuilder_ = null;
        }
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public com.google.cloud.contentwarehouse.v1.QAResult.Builder getQaResultBuilder() {
        bitField0_ |= 0x00000004;
        onChanged();
        return getQaResultFieldBuilder().getBuilder();
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      public com.google.cloud.contentwarehouse.v1.QAResultOrBuilder getQaResultOrBuilder() {
        if (qaResultBuilder_ != null) {
          return qaResultBuilder_.getMessageOrBuilder();
        } else {
          return qaResult_ == null
              ? com.google.cloud.contentwarehouse.v1.QAResult.getDefaultInstance()
              : qaResult_;
        }
      }
      /**
       *
       *
       * <pre>
       * Experimental.
       * Additional result info if the question-answering feature is enabled.
       * </pre>
       *
       * <code>.google.cloud.contentwarehouse.v1.QAResult qa_result = 3;</code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.cloud.contentwarehouse.v1.QAResult,
              com.google.cloud.contentwarehouse.v1.QAResult.Builder,
              com.google.cloud.contentwarehouse.v1.QAResultOrBuilder>
          getQaResultFieldBuilder() {
        if (qaResultBuilder_ == null) {
          qaResultBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.cloud.contentwarehouse.v1.QAResult,
                  com.google.cloud.contentwarehouse.v1.QAResult.Builder,
                  com.google.cloud.contentwarehouse.v1.QAResultOrBuilder>(
                  getQaResult(), getParentForChildren(), isClean());
          qaResult_ = null;
        }
        return qaResultBuilder_;
      }

      @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:google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
    }

    // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument)
    private static final com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
            .MatchingDocument
        DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE =
          new com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument();
    }

    public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<MatchingDocument> PARSER =
        new com.google.protobuf.AbstractParser<MatchingDocument>() {
          @java.lang.Override
          public MatchingDocument 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<MatchingDocument> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<MatchingDocument> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public static final int MATCHING_DOCUMENTS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private java.util.List<
          com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>
      matchingDocuments_;
  /**
   *
   *
   * <pre>
   * The document entities that match the specified
   * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
   * </code>
   */
  @java.lang.Override
  public java.util.List<
          com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>
      getMatchingDocumentsList() {
    return matchingDocuments_;
  }
  /**
   *
   *
   * <pre>
   * The document entities that match the specified
   * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
   * </code>
   */
  @java.lang.Override
  public java.util.List<
          ? extends
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
                  .MatchingDocumentOrBuilder>
      getMatchingDocumentsOrBuilderList() {
    return matchingDocuments_;
  }
  /**
   *
   *
   * <pre>
   * The document entities that match the specified
   * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
   * </code>
   */
  @java.lang.Override
  public int getMatchingDocumentsCount() {
    return matchingDocuments_.size();
  }
  /**
   *
   *
   * <pre>
   * The document entities that match the specified
   * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
      getMatchingDocuments(int index) {
    return matchingDocuments_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The document entities that match the specified
   * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocumentOrBuilder
      getMatchingDocumentsOrBuilder(int index) {
    return matchingDocuments_.get(index);
  }

  public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object nextPageToken_ = "";
  /**
   *
   *
   * <pre>
   * The token that specifies the starting position of the next page of results.
   * This field is empty if there are no more results.
   * </pre>
   *
   * <code>string next_page_token = 2;</code>
   *
   * @return The nextPageToken.
   */
  @java.lang.Override
  public java.lang.String getNextPageToken() {
    java.lang.Object ref = nextPageToken_;
    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();
      nextPageToken_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The token that specifies the starting position of the next page of results.
   * This field is empty if there are no more results.
   * </pre>
   *
   * <code>string next_page_token = 2;</code>
   *
   * @return The bytes for nextPageToken.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getNextPageTokenBytes() {
    java.lang.Object ref = nextPageToken_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      nextPageToken_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TOTAL_SIZE_FIELD_NUMBER = 3;
  private int totalSize_ = 0;
  /**
   *
   *
   * <pre>
   * The total number of matched documents which is available only if the client
   * set
   * [SearchDocumentsRequest.require_total_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.require_total_size]
   * to `true` or set
   * [SearchDocumentsRequest.total_result_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.total_result_size]
   * to `ESTIMATED_SIZE` or `ACTUAL_SIZE`. Otherwise, the value will be `-1`.
   * Typically a UI would handle this condition by displaying &amp;quot;of
   * many&amp;quot;, for example: &amp;quot;Displaying 10 of many&amp;quot;.
   * </pre>
   *
   * <code>int32 total_size = 3;</code>
   *
   * @return The totalSize.
   */
  @java.lang.Override
  public int getTotalSize() {
    return totalSize_;
  }

  public static final int METADATA_FIELD_NUMBER = 4;
  private com.google.cloud.contentwarehouse.v1.ResponseMetadata metadata_;
  /**
   *
   *
   * <pre>
   * Additional information for the API invocation, such as the request tracking
   * id.
   * </pre>
   *
   * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
   *
   * @return Whether the metadata field is set.
   */
  @java.lang.Override
  public boolean hasMetadata() {
    return metadata_ != null;
  }
  /**
   *
   *
   * <pre>
   * Additional information for the API invocation, such as the request tracking
   * id.
   * </pre>
   *
   * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
   *
   * @return The metadata.
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.ResponseMetadata getMetadata() {
    return metadata_ == null
        ? com.google.cloud.contentwarehouse.v1.ResponseMetadata.getDefaultInstance()
        : metadata_;
  }
  /**
   *
   *
   * <pre>
   * Additional information for the API invocation, such as the request tracking
   * id.
   * </pre>
   *
   * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.ResponseMetadataOrBuilder getMetadataOrBuilder() {
    return metadata_ == null
        ? com.google.cloud.contentwarehouse.v1.ResponseMetadata.getDefaultInstance()
        : metadata_;
  }

  public static final int HISTOGRAM_QUERY_RESULTS_FIELD_NUMBER = 6;

  @SuppressWarnings("serial")
  private java.util.List<com.google.cloud.contentwarehouse.v1.HistogramQueryResult>
      histogramQueryResults_;
  /**
   *
   *
   * <pre>
   * The histogram results that match with the specified
   * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
   * </code>
   */
  @java.lang.Override
  public java.util.List<com.google.cloud.contentwarehouse.v1.HistogramQueryResult>
      getHistogramQueryResultsList() {
    return histogramQueryResults_;
  }
  /**
   *
   *
   * <pre>
   * The histogram results that match with the specified
   * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
   * </code>
   */
  @java.lang.Override
  public java.util.List<
          ? extends com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder>
      getHistogramQueryResultsOrBuilderList() {
    return histogramQueryResults_;
  }
  /**
   *
   *
   * <pre>
   * The histogram results that match with the specified
   * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
   * </code>
   */
  @java.lang.Override
  public int getHistogramQueryResultsCount() {
    return histogramQueryResults_.size();
  }
  /**
   *
   *
   * <pre>
   * The histogram results that match with the specified
   * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.HistogramQueryResult getHistogramQueryResults(
      int index) {
    return histogramQueryResults_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The histogram results that match with the specified
   * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
   * </pre>
   *
   * <code>
   * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder
      getHistogramQueryResultsOrBuilder(int index) {
    return histogramQueryResults_.get(index);
  }

  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 {
    for (int i = 0; i < matchingDocuments_.size(); i++) {
      output.writeMessage(1, matchingDocuments_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_);
    }
    if (totalSize_ != 0) {
      output.writeInt32(3, totalSize_);
    }
    if (metadata_ != null) {
      output.writeMessage(4, getMetadata());
    }
    for (int i = 0; i < histogramQueryResults_.size(); i++) {
      output.writeMessage(6, histogramQueryResults_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < matchingDocuments_.size(); i++) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(1, matchingDocuments_.get(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_);
    }
    if (totalSize_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, totalSize_);
    }
    if (metadata_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getMetadata());
    }
    for (int i = 0; i < histogramQueryResults_.size(); i++) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              6, histogramQueryResults_.get(i));
    }
    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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse)) {
      return super.equals(obj);
    }
    com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse other =
        (com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse) obj;

    if (!getMatchingDocumentsList().equals(other.getMatchingDocumentsList())) return false;
    if (!getNextPageToken().equals(other.getNextPageToken())) return false;
    if (getTotalSize() != other.getTotalSize()) return false;
    if (hasMetadata() != other.hasMetadata()) return false;
    if (hasMetadata()) {
      if (!getMetadata().equals(other.getMetadata())) return false;
    }
    if (!getHistogramQueryResultsList().equals(other.getHistogramQueryResultsList())) 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();
    if (getMatchingDocumentsCount() > 0) {
      hash = (37 * hash) + MATCHING_DOCUMENTS_FIELD_NUMBER;
      hash = (53 * hash) + getMatchingDocumentsList().hashCode();
    }
    hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER;
    hash = (53 * hash) + getNextPageToken().hashCode();
    hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER;
    hash = (53 * hash) + getTotalSize();
    if (hasMetadata()) {
      hash = (37 * hash) + METADATA_FIELD_NUMBER;
      hash = (53 * hash) + getMetadata().hashCode();
    }
    if (getHistogramQueryResultsCount() > 0) {
      hash = (37 * hash) + HISTOGRAM_QUERY_RESULTS_FIELD_NUMBER;
      hash = (53 * hash) + getHistogramQueryResultsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse 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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse 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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse 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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse 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;
  }
  /**
   *
   *
   * <pre>
   * Response message for DocumentService.SearchDocuments.
   * </pre>
   *
   * Protobuf type {@code google.cloud.contentwarehouse.v1.SearchDocumentsResponse}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.contentwarehouse.v1.SearchDocumentsResponse)
      com.google.cloud.contentwarehouse.v1.SearchDocumentsResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.class,
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.Builder.class);
    }

    // Construct using com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (matchingDocumentsBuilder_ == null) {
        matchingDocuments_ = java.util.Collections.emptyList();
      } else {
        matchingDocuments_ = null;
        matchingDocumentsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      nextPageToken_ = "";
      totalSize_ = 0;
      metadata_ = null;
      if (metadataBuilder_ != null) {
        metadataBuilder_.dispose();
        metadataBuilder_ = null;
      }
      if (histogramQueryResultsBuilder_ == null) {
        histogramQueryResults_ = java.util.Collections.emptyList();
      } else {
        histogramQueryResults_ = null;
        histogramQueryResultsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000010);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.contentwarehouse.v1.DocumentServiceProto
          .internal_static_google_cloud_contentwarehouse_v1_SearchDocumentsResponse_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
        getDefaultInstanceForType() {
      return com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse build() {
      com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse buildPartial() {
      com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse result =
          new com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse result) {
      if (matchingDocumentsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          matchingDocuments_ = java.util.Collections.unmodifiableList(matchingDocuments_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.matchingDocuments_ = matchingDocuments_;
      } else {
        result.matchingDocuments_ = matchingDocumentsBuilder_.build();
      }
      if (histogramQueryResultsBuilder_ == null) {
        if (((bitField0_ & 0x00000010) != 0)) {
          histogramQueryResults_ = java.util.Collections.unmodifiableList(histogramQueryResults_);
          bitField0_ = (bitField0_ & ~0x00000010);
        }
        result.histogramQueryResults_ = histogramQueryResults_;
      } else {
        result.histogramQueryResults_ = histogramQueryResultsBuilder_.build();
      }
    }

    private void buildPartial0(
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.nextPageToken_ = nextPageToken_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.totalSize_ = totalSize_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.metadata_ = metadataBuilder_ == null ? metadata_ : metadataBuilder_.build();
      }
    }

    @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.google.cloud.contentwarehouse.v1.SearchDocumentsResponse) {
        return mergeFrom((com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse other) {
      if (other
          == com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.getDefaultInstance())
        return this;
      if (matchingDocumentsBuilder_ == null) {
        if (!other.matchingDocuments_.isEmpty()) {
          if (matchingDocuments_.isEmpty()) {
            matchingDocuments_ = other.matchingDocuments_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureMatchingDocumentsIsMutable();
            matchingDocuments_.addAll(other.matchingDocuments_);
          }
          onChanged();
        }
      } else {
        if (!other.matchingDocuments_.isEmpty()) {
          if (matchingDocumentsBuilder_.isEmpty()) {
            matchingDocumentsBuilder_.dispose();
            matchingDocumentsBuilder_ = null;
            matchingDocuments_ = other.matchingDocuments_;
            bitField0_ = (bitField0_ & ~0x00000001);
            matchingDocumentsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getMatchingDocumentsFieldBuilder()
                    : null;
          } else {
            matchingDocumentsBuilder_.addAllMessages(other.matchingDocuments_);
          }
        }
      }
      if (!other.getNextPageToken().isEmpty()) {
        nextPageToken_ = other.nextPageToken_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (other.getTotalSize() != 0) {
        setTotalSize(other.getTotalSize());
      }
      if (other.hasMetadata()) {
        mergeMetadata(other.getMetadata());
      }
      if (histogramQueryResultsBuilder_ == null) {
        if (!other.histogramQueryResults_.isEmpty()) {
          if (histogramQueryResults_.isEmpty()) {
            histogramQueryResults_ = other.histogramQueryResults_;
            bitField0_ = (bitField0_ & ~0x00000010);
          } else {
            ensureHistogramQueryResultsIsMutable();
            histogramQueryResults_.addAll(other.histogramQueryResults_);
          }
          onChanged();
        }
      } else {
        if (!other.histogramQueryResults_.isEmpty()) {
          if (histogramQueryResultsBuilder_.isEmpty()) {
            histogramQueryResultsBuilder_.dispose();
            histogramQueryResultsBuilder_ = null;
            histogramQueryResults_ = other.histogramQueryResults_;
            bitField0_ = (bitField0_ & ~0x00000010);
            histogramQueryResultsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getHistogramQueryResultsFieldBuilder()
                    : null;
          } else {
            histogramQueryResultsBuilder_.addAllMessages(other.histogramQueryResults_);
          }
        }
      }
      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:
              {
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument m =
                    input.readMessage(
                        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
                            .MatchingDocument.parser(),
                        extensionRegistry);
                if (matchingDocumentsBuilder_ == null) {
                  ensureMatchingDocumentsIsMutable();
                  matchingDocuments_.add(m);
                } else {
                  matchingDocumentsBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 18:
              {
                nextPageToken_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 24:
              {
                totalSize_ = input.readInt32();
                bitField0_ |= 0x00000004;
                break;
              } // case 24
            case 34:
              {
                input.readMessage(getMetadataFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000008;
                break;
              } // case 34
            case 50:
              {
                com.google.cloud.contentwarehouse.v1.HistogramQueryResult m =
                    input.readMessage(
                        com.google.cloud.contentwarehouse.v1.HistogramQueryResult.parser(),
                        extensionRegistry);
                if (histogramQueryResultsBuilder_ == null) {
                  ensureHistogramQueryResultsIsMutable();
                  histogramQueryResults_.add(m);
                } else {
                  histogramQueryResultsBuilder_.addMessage(m);
                }
                break;
              } // case 50
            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.util.List<
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>
        matchingDocuments_ = java.util.Collections.emptyList();

    private void ensureMatchingDocumentsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        matchingDocuments_ =
            new java.util.ArrayList<
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>(
                matchingDocuments_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument,
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder,
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocumentOrBuilder>
        matchingDocumentsBuilder_;

    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public java.util.List<
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>
        getMatchingDocumentsList() {
      if (matchingDocumentsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(matchingDocuments_);
      } else {
        return matchingDocumentsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public int getMatchingDocumentsCount() {
      if (matchingDocumentsBuilder_ == null) {
        return matchingDocuments_.size();
      } else {
        return matchingDocumentsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
        getMatchingDocuments(int index) {
      if (matchingDocumentsBuilder_ == null) {
        return matchingDocuments_.get(index);
      } else {
        return matchingDocumentsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder setMatchingDocuments(
        int index,
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument value) {
      if (matchingDocumentsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.set(index, value);
        onChanged();
      } else {
        matchingDocumentsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder setMatchingDocuments(
        int index,
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
            builderForValue) {
      if (matchingDocumentsBuilder_ == null) {
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.set(index, builderForValue.build());
        onChanged();
      } else {
        matchingDocumentsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder addMatchingDocuments(
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument value) {
      if (matchingDocumentsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.add(value);
        onChanged();
      } else {
        matchingDocumentsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder addMatchingDocuments(
        int index,
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument value) {
      if (matchingDocumentsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.add(index, value);
        onChanged();
      } else {
        matchingDocumentsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder addMatchingDocuments(
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
            builderForValue) {
      if (matchingDocumentsBuilder_ == null) {
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.add(builderForValue.build());
        onChanged();
      } else {
        matchingDocumentsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder addMatchingDocuments(
        int index,
        com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
            builderForValue) {
      if (matchingDocumentsBuilder_ == null) {
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.add(index, builderForValue.build());
        onChanged();
      } else {
        matchingDocumentsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder addAllMatchingDocuments(
        java.lang.Iterable<
                ? extends
                    com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument>
            values) {
      if (matchingDocumentsBuilder_ == null) {
        ensureMatchingDocumentsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, matchingDocuments_);
        onChanged();
      } else {
        matchingDocumentsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder clearMatchingDocuments() {
      if (matchingDocumentsBuilder_ == null) {
        matchingDocuments_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        matchingDocumentsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public Builder removeMatchingDocuments(int index) {
      if (matchingDocumentsBuilder_ == null) {
        ensureMatchingDocumentsIsMutable();
        matchingDocuments_.remove(index);
        onChanged();
      } else {
        matchingDocumentsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
        getMatchingDocumentsBuilder(int index) {
      return getMatchingDocumentsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocumentOrBuilder
        getMatchingDocumentsOrBuilder(int index) {
      if (matchingDocumentsBuilder_ == null) {
        return matchingDocuments_.get(index);
      } else {
        return matchingDocumentsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public java.util.List<
            ? extends
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
                    .MatchingDocumentOrBuilder>
        getMatchingDocumentsOrBuilderList() {
      if (matchingDocumentsBuilder_ != null) {
        return matchingDocumentsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(matchingDocuments_);
      }
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
        addMatchingDocumentsBuilder() {
      return getMatchingDocumentsFieldBuilder()
          .addBuilder(
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
                  .getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder
        addMatchingDocumentsBuilder(int index) {
      return getMatchingDocumentsFieldBuilder()
          .addBuilder(
              index,
              com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
                  .getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * The document entities that match the specified
     * [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument matching_documents = 1;
     * </code>
     */
    public java.util.List<
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder>
        getMatchingDocumentsBuilderList() {
      return getMatchingDocumentsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument,
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument.Builder,
            com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocumentOrBuilder>
        getMatchingDocumentsFieldBuilder() {
      if (matchingDocumentsBuilder_ == null) {
        matchingDocumentsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument,
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse.MatchingDocument
                    .Builder,
                com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
                    .MatchingDocumentOrBuilder>(
                matchingDocuments_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        matchingDocuments_ = null;
      }
      return matchingDocumentsBuilder_;
    }

    private java.lang.Object nextPageToken_ = "";
    /**
     *
     *
     * <pre>
     * The token that specifies the starting position of the next page of results.
     * This field is empty if there are no more results.
     * </pre>
     *
     * <code>string next_page_token = 2;</code>
     *
     * @return The nextPageToken.
     */
    public java.lang.String getNextPageToken() {
      java.lang.Object ref = nextPageToken_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        nextPageToken_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The token that specifies the starting position of the next page of results.
     * This field is empty if there are no more results.
     * </pre>
     *
     * <code>string next_page_token = 2;</code>
     *
     * @return The bytes for nextPageToken.
     */
    public com.google.protobuf.ByteString getNextPageTokenBytes() {
      java.lang.Object ref = nextPageToken_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        nextPageToken_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The token that specifies the starting position of the next page of results.
     * This field is empty if there are no more results.
     * </pre>
     *
     * <code>string next_page_token = 2;</code>
     *
     * @param value The nextPageToken to set.
     * @return This builder for chaining.
     */
    public Builder setNextPageToken(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      nextPageToken_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The token that specifies the starting position of the next page of results.
     * This field is empty if there are no more results.
     * </pre>
     *
     * <code>string next_page_token = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearNextPageToken() {
      nextPageToken_ = getDefaultInstance().getNextPageToken();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The token that specifies the starting position of the next page of results.
     * This field is empty if there are no more results.
     * </pre>
     *
     * <code>string next_page_token = 2;</code>
     *
     * @param value The bytes for nextPageToken to set.
     * @return This builder for chaining.
     */
    public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      nextPageToken_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private int totalSize_;
    /**
     *
     *
     * <pre>
     * The total number of matched documents which is available only if the client
     * set
     * [SearchDocumentsRequest.require_total_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.require_total_size]
     * to `true` or set
     * [SearchDocumentsRequest.total_result_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.total_result_size]
     * to `ESTIMATED_SIZE` or `ACTUAL_SIZE`. Otherwise, the value will be `-1`.
     * Typically a UI would handle this condition by displaying &amp;quot;of
     * many&amp;quot;, for example: &amp;quot;Displaying 10 of many&amp;quot;.
     * </pre>
     *
     * <code>int32 total_size = 3;</code>
     *
     * @return The totalSize.
     */
    @java.lang.Override
    public int getTotalSize() {
      return totalSize_;
    }
    /**
     *
     *
     * <pre>
     * The total number of matched documents which is available only if the client
     * set
     * [SearchDocumentsRequest.require_total_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.require_total_size]
     * to `true` or set
     * [SearchDocumentsRequest.total_result_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.total_result_size]
     * to `ESTIMATED_SIZE` or `ACTUAL_SIZE`. Otherwise, the value will be `-1`.
     * Typically a UI would handle this condition by displaying &amp;quot;of
     * many&amp;quot;, for example: &amp;quot;Displaying 10 of many&amp;quot;.
     * </pre>
     *
     * <code>int32 total_size = 3;</code>
     *
     * @param value The totalSize to set.
     * @return This builder for chaining.
     */
    public Builder setTotalSize(int value) {

      totalSize_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The total number of matched documents which is available only if the client
     * set
     * [SearchDocumentsRequest.require_total_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.require_total_size]
     * to `true` or set
     * [SearchDocumentsRequest.total_result_size][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.total_result_size]
     * to `ESTIMATED_SIZE` or `ACTUAL_SIZE`. Otherwise, the value will be `-1`.
     * Typically a UI would handle this condition by displaying &amp;quot;of
     * many&amp;quot;, for example: &amp;quot;Displaying 10 of many&amp;quot;.
     * </pre>
     *
     * <code>int32 total_size = 3;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearTotalSize() {
      bitField0_ = (bitField0_ & ~0x00000004);
      totalSize_ = 0;
      onChanged();
      return this;
    }

    private com.google.cloud.contentwarehouse.v1.ResponseMetadata metadata_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.ResponseMetadata,
            com.google.cloud.contentwarehouse.v1.ResponseMetadata.Builder,
            com.google.cloud.contentwarehouse.v1.ResponseMetadataOrBuilder>
        metadataBuilder_;
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     *
     * @return Whether the metadata field is set.
     */
    public boolean hasMetadata() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     *
     * @return The metadata.
     */
    public com.google.cloud.contentwarehouse.v1.ResponseMetadata getMetadata() {
      if (metadataBuilder_ == null) {
        return metadata_ == null
            ? com.google.cloud.contentwarehouse.v1.ResponseMetadata.getDefaultInstance()
            : metadata_;
      } else {
        return metadataBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public Builder setMetadata(com.google.cloud.contentwarehouse.v1.ResponseMetadata value) {
      if (metadataBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        metadata_ = value;
      } else {
        metadataBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public Builder setMetadata(
        com.google.cloud.contentwarehouse.v1.ResponseMetadata.Builder builderForValue) {
      if (metadataBuilder_ == null) {
        metadata_ = builderForValue.build();
      } else {
        metadataBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public Builder mergeMetadata(com.google.cloud.contentwarehouse.v1.ResponseMetadata value) {
      if (metadataBuilder_ == null) {
        if (((bitField0_ & 0x00000008) != 0)
            && metadata_ != null
            && metadata_
                != com.google.cloud.contentwarehouse.v1.ResponseMetadata.getDefaultInstance()) {
          getMetadataBuilder().mergeFrom(value);
        } else {
          metadata_ = value;
        }
      } else {
        metadataBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public Builder clearMetadata() {
      bitField0_ = (bitField0_ & ~0x00000008);
      metadata_ = null;
      if (metadataBuilder_ != null) {
        metadataBuilder_.dispose();
        metadataBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public com.google.cloud.contentwarehouse.v1.ResponseMetadata.Builder getMetadataBuilder() {
      bitField0_ |= 0x00000008;
      onChanged();
      return getMetadataFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    public com.google.cloud.contentwarehouse.v1.ResponseMetadataOrBuilder getMetadataOrBuilder() {
      if (metadataBuilder_ != null) {
        return metadataBuilder_.getMessageOrBuilder();
      } else {
        return metadata_ == null
            ? com.google.cloud.contentwarehouse.v1.ResponseMetadata.getDefaultInstance()
            : metadata_;
      }
    }
    /**
     *
     *
     * <pre>
     * Additional information for the API invocation, such as the request tracking
     * id.
     * </pre>
     *
     * <code>.google.cloud.contentwarehouse.v1.ResponseMetadata metadata = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.ResponseMetadata,
            com.google.cloud.contentwarehouse.v1.ResponseMetadata.Builder,
            com.google.cloud.contentwarehouse.v1.ResponseMetadataOrBuilder>
        getMetadataFieldBuilder() {
      if (metadataBuilder_ == null) {
        metadataBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.contentwarehouse.v1.ResponseMetadata,
                com.google.cloud.contentwarehouse.v1.ResponseMetadata.Builder,
                com.google.cloud.contentwarehouse.v1.ResponseMetadataOrBuilder>(
                getMetadata(), getParentForChildren(), isClean());
        metadata_ = null;
      }
      return metadataBuilder_;
    }

    private java.util.List<com.google.cloud.contentwarehouse.v1.HistogramQueryResult>
        histogramQueryResults_ = java.util.Collections.emptyList();

    private void ensureHistogramQueryResultsIsMutable() {
      if (!((bitField0_ & 0x00000010) != 0)) {
        histogramQueryResults_ =
            new java.util.ArrayList<com.google.cloud.contentwarehouse.v1.HistogramQueryResult>(
                histogramQueryResults_);
        bitField0_ |= 0x00000010;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.HistogramQueryResult,
            com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder,
            com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder>
        histogramQueryResultsBuilder_;

    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.HistogramQueryResult>
        getHistogramQueryResultsList() {
      if (histogramQueryResultsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(histogramQueryResults_);
      } else {
        return histogramQueryResultsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public int getHistogramQueryResultsCount() {
      if (histogramQueryResultsBuilder_ == null) {
        return histogramQueryResults_.size();
      } else {
        return histogramQueryResultsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.HistogramQueryResult getHistogramQueryResults(
        int index) {
      if (histogramQueryResultsBuilder_ == null) {
        return histogramQueryResults_.get(index);
      } else {
        return histogramQueryResultsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder setHistogramQueryResults(
        int index, com.google.cloud.contentwarehouse.v1.HistogramQueryResult value) {
      if (histogramQueryResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.set(index, value);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder setHistogramQueryResults(
        int index,
        com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder builderForValue) {
      if (histogramQueryResultsBuilder_ == null) {
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.set(index, builderForValue.build());
        onChanged();
      } else {
        histogramQueryResultsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder addHistogramQueryResults(
        com.google.cloud.contentwarehouse.v1.HistogramQueryResult value) {
      if (histogramQueryResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.add(value);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder addHistogramQueryResults(
        int index, com.google.cloud.contentwarehouse.v1.HistogramQueryResult value) {
      if (histogramQueryResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.add(index, value);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder addHistogramQueryResults(
        com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder builderForValue) {
      if (histogramQueryResultsBuilder_ == null) {
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.add(builderForValue.build());
        onChanged();
      } else {
        histogramQueryResultsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder addHistogramQueryResults(
        int index,
        com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder builderForValue) {
      if (histogramQueryResultsBuilder_ == null) {
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.add(index, builderForValue.build());
        onChanged();
      } else {
        histogramQueryResultsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder addAllHistogramQueryResults(
        java.lang.Iterable<? extends com.google.cloud.contentwarehouse.v1.HistogramQueryResult>
            values) {
      if (histogramQueryResultsBuilder_ == null) {
        ensureHistogramQueryResultsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, histogramQueryResults_);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder clearHistogramQueryResults() {
      if (histogramQueryResultsBuilder_ == null) {
        histogramQueryResults_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000010);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public Builder removeHistogramQueryResults(int index) {
      if (histogramQueryResultsBuilder_ == null) {
        ensureHistogramQueryResultsIsMutable();
        histogramQueryResults_.remove(index);
        onChanged();
      } else {
        histogramQueryResultsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder
        getHistogramQueryResultsBuilder(int index) {
      return getHistogramQueryResultsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder
        getHistogramQueryResultsOrBuilder(int index) {
      if (histogramQueryResultsBuilder_ == null) {
        return histogramQueryResults_.get(index);
      } else {
        return histogramQueryResultsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public java.util.List<
            ? extends com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder>
        getHistogramQueryResultsOrBuilderList() {
      if (histogramQueryResultsBuilder_ != null) {
        return histogramQueryResultsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(histogramQueryResults_);
      }
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder
        addHistogramQueryResultsBuilder() {
      return getHistogramQueryResultsFieldBuilder()
          .addBuilder(
              com.google.cloud.contentwarehouse.v1.HistogramQueryResult.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder
        addHistogramQueryResultsBuilder(int index) {
      return getHistogramQueryResultsFieldBuilder()
          .addBuilder(
              index,
              com.google.cloud.contentwarehouse.v1.HistogramQueryResult.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * The histogram results that match with the specified
     * [SearchDocumentsRequest.histogram_queries][google.cloud.contentwarehouse.v1.SearchDocumentsRequest.histogram_queries].
     * </pre>
     *
     * <code>
     * repeated .google.cloud.contentwarehouse.v1.HistogramQueryResult histogram_query_results = 6;
     * </code>
     */
    public java.util.List<com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder>
        getHistogramQueryResultsBuilderList() {
      return getHistogramQueryResultsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.contentwarehouse.v1.HistogramQueryResult,
            com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder,
            com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder>
        getHistogramQueryResultsFieldBuilder() {
      if (histogramQueryResultsBuilder_ == null) {
        histogramQueryResultsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.contentwarehouse.v1.HistogramQueryResult,
                com.google.cloud.contentwarehouse.v1.HistogramQueryResult.Builder,
                com.google.cloud.contentwarehouse.v1.HistogramQueryResultOrBuilder>(
                histogramQueryResults_,
                ((bitField0_ & 0x00000010) != 0),
                getParentForChildren(),
                isClean());
        histogramQueryResults_ = null;
      }
      return histogramQueryResultsBuilder_;
    }

    @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:google.cloud.contentwarehouse.v1.SearchDocumentsResponse)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.contentwarehouse.v1.SearchDocumentsResponse)
  private static final com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse();
  }

  public static com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<SearchDocumentsResponse> PARSER =
      new com.google.protobuf.AbstractParser<SearchDocumentsResponse>() {
        @java.lang.Override
        public SearchDocumentsResponse 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<SearchDocumentsResponse> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<SearchDocumentsResponse> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
