younifyd
Menu

Retrieve Passage V3

Retrieves the passage(s) for a particular query.

POST/rest/search/v3/passages/retrieve

Use it in a workflow

  1. Add a step and choose the Coveo connector.
  2. Pick the Retrieve Passage V3 action (under Search).
  3. Fill in the fields below, then reference the result from later steps as {{retrievePassageV3.response.data}}.

Request

Query parameters

organizationIdstring

The unique identifier of the target Coveo Cloud organization. Specifying a value for this parameter is only necessary when you are authenticating the API call with an OAuth2 token.

Request body

Enter the body as JSON in the step's Body field.

additionalFieldsarray<string>

The fields to include in the response. When omitted, only the identifier of the document will be returned.

analyticsobject
captureboolean

Whether the API call should be tracked for analytics. When not provided, it defaults to `false`.

clientIdstring

A UUID identifying the client or agent that generated the event.

userAgentstring

The user agent of the request. If not present, the user agent is obtained from the [User-Agent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) header. **Note**: This information is required when endpoints are behind a proxy.

contextobject

The custom context information to send along with the request. Must be a dictionary of key-value pairs (JSON) where each key is a string, and each value is either a string or an array of strings. Coveo Machine Learning models may use this information to provide contextually relevant output. Moreover, this information can be referred to in query expressions and QPL statements by using the `$context` object.

filterstring

A filter expression that will be applied during the first stage retrieval. The expression must comply with the Coveo Query Language (CQL) syntax.

localizationobjectrequired

Localization parameter.

localestringrequired

The locale of the current user. Must comply with IETF's BCP 47 definition. Coveo Machine Learning models use this information to provide contextually relevant output. Moreover, this information can be referred to in query expressions and QPL statements by using the $locale object. Note: When logging a Search usage analytics event, the language field of that event should match the language part of the locale value of the query (e.g., en-US in locale becomes en in language).

timezonestring

The [tz database identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the user's time zone. Used for interpreting dates in query expressions and retrieving passages.

maxPassagesinteger (int32)

The maximum number of passage(s) to retrieve.

Default 5

pipelinestring

The name of the query pipeline to use for this request (bypassing its conditions, if it has any). You can pass an empty `pipeline` value to use an empty query pipeline (i.e., `?pipeline=` or `"pipeline": ""`). If a query does not contain the `pipeline` parameter, the first query pipeline whose conditions are met by the request is used (query pipelines without conditions are not evaluated). Should the request fail to meet the conditions of each evaluated query pipeline, the default query pipeline of the target Coveo Cloud organization is used (bypassing its conditions, if it has any). **Notes:** - This parameter will be overridden if the search request is authenticated by a [search token](https://docs.coveo.com/en/56/) that enforces a specific [`pipeline`](https://docs.coveo.com/en/56/#pipeline-string-optional), or a [`searchHub`](https://docs.coveo.com/en/56/#searchhub-string-optional) that routes queries to a specific `pipeline` via a query pipeline condition. - For reporting purposes, when logging a **Search** usage analytics event for a query, the `queryPipeline` field of that event should be set to the final `pipeline` value used in the query execution. This value is determined from the query response. If no pipeline was specified, it uses the `"default"` value. See also [Managing Query Pipelines](https://docs.coveo.com/en/1450/).

querystringrequired

The query for which to retrieve the passage(s).

searchHubstring

The first level of origin of the request, typically the identifier of the graphical search interface from which the request originates. Coveo Machine Learning models use this information to provide contextually relevant output. **Notes:** - This parameter will be overridden if the search request is authenticated by a [search token](https://docs.coveo.com/en/56/) that enforces a specific [`pipeline`](https://docs.coveo.com/en/56/#pipeline-string-optional), or a [`searchHub`](https://docs.coveo.com/en/56/#searchhub-string-optional) that routes queries to a specific `pipeline` via a query pipeline condition. - When logging a **Search** usage analytics event for a query, the `originLevel1` field of that event should be set to the value of the `searchHub` search request parameter.

json
{
  "localization": {
    "locale": "en-CA",
    "timezone": "America/Montreal"
  },
  "query": "What are the benefits of using solar energy?",
  "additionalFields": [
    "clickableuri"
  ],
  "analytics": {
    "capture": false,
    "clientId": "string",
    "userAgent": "string"
  },
  "context": {
    "userAgeRange": "25-35",
    "userRoles": [
      "PremiumCustomer",
      "ProductReviewer"
    ]
  },
  "filter": "@source==\"acme\"\n",
  "maxPassages": 5,
  "pipeline": "CustomerQueryPipeline",
  "searchHub": "Main"
}

Response

Returns 200 with an object. Read it in later steps with {{retrievePassageV3.response.data.<field>}}.

itemsarray<object>
documentobjectrequired2 fields
relevanceScorenumber (float)required

A score that indicates the relevance of a passage. The score computation is based on cosine similarity between the passage and the query. The computation logic and value range may change in the future. Example values: - A value of -1 (minimum) indicates that the passage is the semantic opposite of the query. - A value of 0 indicates that the passage is not semantically similar to the query. - A value of 1 (maximum) indicates that the passage is semantically similar to the query.

textstringrequired

The text associated to this passage.

responseIdstring

A unique identifier for the retrieval request. This identifier can be used to track the retrieval request.

json
{
  "items": [
    {
      "document": {
        "primaryid": "bDMzdA",
        "title": "The Benefits of Solar Energy"
      },
      "relevanceScore": 0.85,
      "text": "Solar energy has several benefits including reducing electricity bills, providing a renewable energy source, and lowering carbon footprint.\""
    }
  ],
  "responseId": "c0857557-5579-4f5e-8958-9befd7d1d4a8"
}

Need more? See the Coveo guide for connection setup and behaviour shared by every action.

Was this page helpful?