Method: documents.searchDocumentChunks

Searches for developer knowledge across Google's developer documentation. This method returns document chunks based on the user's query. There can be many chunks of the same Document. To retrieve full documents, use DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments with the DocumentChunk.parent returned in the SearchDocumentChunksResponse.results.

HTTP request

GET https://developerknowledge.googleapis.com/v1alpha/documents:searchDocumentChunks

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
query

string

Required. The raw query string provided by the user, such as "How to create a Cloud Storage bucket?".

pageSize

integer

Optional. The maximum number of results to return. The service may return fewer than this value.

If unspecified, at most 5 results will be returned.

The maximum value is 20; values above 20 will result in an INVALID_ARGUMENT error.

pageToken

string

Optional. A page token, received from a previous documents.searchDocumentChunks call. Provide this to retrieve the subsequent page.

Request body

The request body must be empty.

Response body

Response message for DeveloperKnowledge.SearchDocumentChunks.

If successful, the response body contains data with the following structure:

JSON representation
{
  "results": [
    {
      object (DocumentChunk)
    }
  ],
  "nextPageToken": string
}
Fields
results[]

object (DocumentChunk)

The search results for the given query. Each DocumentChunk in this list contains a snippet of content relevant to the search query. Use the DocumentChunk.parent field of each result with DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments to retrieve the full document content.

nextPageToken

string

Optional. A token that can be sent as pageToken to retrieve the next page. If this field is omitted, there are no subsequent pages.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/devprofiles.full_control

For more information, see the OAuth 2.0 Overview.

DocumentChunk

A DocumentChunk represents a piece of content from a Document in the DeveloperKnowledge corpus. To fetch the entire document content, pass the parent to DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments.

JSON representation
{
  "parent": string,
  "id": string,
  "content": string
}
Fields
parent

string

Output only. The resource name of the document this chunk is from. Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets

id

string

Output only. The ID of this chunk within the document. The chunk ID is unique within a document, but not globally unique across documents. The chunk ID is not stable and may change over time.

content

string

Output only. The content of the document chunk.