Support Menu

Class SearchEndpoint

Class SearchEndpoint

The SearchEndpoint class allows you to execute various actions against the Coveo Search API and a Coveo index (e.g., searching, listing field values, getting the quickview content of an item, etc.).

This class does trigger any query events directly. Consequently, executing an action with this class does not trigger a full query cycle for the Coveo components.

If you wish to have all Coveo components "react" to a query, (and trigger the corresponding query events), use the QueryController class instead.

Index

Methods

deleteSubscription

extensions

follow

getAuthenticationProviderUri

  • Gets the URI that can be used to authenticate against the given provider.

    Parameters

    • provider: string

      The provider name.

    • Optional returnUri: string

      The URI to return to after the authentication is completed.

    • Optional message: string

      The authentication message.

    • Optional callOptions: IEndpointCallOptions

      Additional set of options to use for this call.

    • Optional callParams: IEndpointCallParameters

      Options injected by the applied decorators.

    Returns string

    The authentication provider URI.

getBaseAlertsUri

  • getBaseAlertsUri(): string

getBaseUri

  • getBaseUri(): string

getDocument

getDocumentHtml

getDocumentText

getExportToExcelLink

  • Gets a link / URI to download a query result set to the XLSX format.

    Note:

    This method does not automatically download the query result set, but rather provides an URI from which to download it.

    Parameters

    • query: IQuery

      The query for which to get the XLSX result set.

    • numberOfResults: number

      The number of results to download.

    • Optional callOptions: IEndpointCallOptions

      An additional set of options to use for this call.

    • Optional callParams: IEndpointCallParameters

      The options injected by the applied decorators.

    Returns string

    The download URI.

getQuerySuggest

getRawDataStream

  • Gets the raw datastream for an item. This is typically used to get a thumbnail for an item.

    Returns an array buffer.

    Example:

    let rawBinary = String.fromCharCode.apply(null, new Uint8Array(response));
    img.setAttribute('src', 'data:image/png;base64,' + btoa(rawBinary));
    

    Parameters

    Returns Promise

getViewAsDatastreamUri

  • Gets an URL from which it is possible to see the datastream for an item. This is typically used to get a thumbnail for an item.

    Parameters

    Returns string

    The datastream URL.

getViewAsHtmlUri

isJsonp

  • isJsonp(): boolean
  • Indicates whether the search endpoint is using JSONP internally to communicate with the Search API.

    Returns boolean

    true in the search enpoint is using JSONP; false otherwise.

listFieldValues

listFields

  • Lists all fields for the index, and returns an array of their descriptions.

    Parameters

    Returns Promise

    A Promise of the index fields and descriptions.

listSubscriptions

rateDocument

search

  • Performs a search on the index and returns a Promise of IQueryResults.

    This method slightly modifies the query results by adding additional information to each result (id, state object, etc.).

    Parameters

    Returns Promise

    A Promise of query results.

setRequestModifier

  • setRequestModifier(requestModifier: function): void
  • Sets a function which allows external code to modify all endpoint call parameters before the browser sends them.

    Note:

    This is useful in very specific scenarios where the network infrastructure requires special request headers to be added or removed, for example.

    Parameters

    Returns void

tagDocument

updateSubscription

Static configureCloudEndpoint

  • configureCloudEndpoint(organization?: string, token?: string, uri?: string, otherOptions?: ISearchEndpointOptions): void
  • Configures a search endpoint on a Coveo Cloud index.

    Parameters

    • Optional organization: string

      The organization ID of your Coveo Cloud index.

    • Optional token: string

      The token to use to execute query. If not specified, you will likely need to login when querying.

    • Default value uri: string = "https://cloudplatform.coveo.com/rest/search"

      The URI of the Coveo Cloud REST Search API. By default, this points to the production environment.

    • Optional otherOptions: ISearchEndpointOptions

      A set of additional options to use when configuring this endpoint.

    Returns void

Static configureCloudV2Endpoint

  • configureCloudV2Endpoint(organization?: string, token?: string, uri?: string, otherOptions?: ISearchEndpointOptions): void
  • Configures a search endpoint on a Coveo Cloud V2 index.

    Parameters

    • Optional organization: string

      The organization ID of your Coveo Cloud V2 index.

    • Optional token: string

      The token to use to execute query. If not specified, you will likely need to login when querying.

    • Default value uri: string = "https://platform.cloud.coveo.com/rest/search"

      The URI of the Coveo Cloud REST Search API. By default, this points to the production environment.

    • Optional otherOptions: ISearchEndpointOptions

      A set of additional options to use when configuring this endpoint.

    Returns void

Static configureOnPremiseEndpoint

  • Configures a search endpoint on a Coveo on-premise index.

    Parameters

    • uri: string

      The URI of your Coveo Search API endpoint (e.g., http://myserver:8080/rest/search)

    • Optional token: string

      The token to use to execute query. If not specified, you will likely need to login when querying (unless your Coveo Search API endpoint is configured using advanced auth options, such as Windows auth or claims).

    • Optional otherOptions: ISearchEndpointOptions

      A set of additional options to use when configuring this endpoint.

    Returns void

Static configureSampleEndpoint

  • Configures a sample search endpoint on a Coveo Cloud index containing a set of public sources with no secured content.

    Note:

    This method mainly exists for demo purposes and ease of setup.

    Parameters

    • Optional otherOptions: ISearchEndpointOptions

      A set of additional options to use when configuring this endpoint.

    Returns void

Static configureSampleEndpointV2

  • Configures a sample search endpoint on a Coveo Cloud V2 index containing a set of public sources with no secured content.

    Note:

    This method mainly exists for demo purposes and ease of setup.

    Parameters

    Returns void

Properties

Static endpoints

endpoints: object

Contains a map of all initialized SearchEndpoint instances.

Example:

Coveo.SearchEndpoint.endpoints['default'] returns the default endpoint that was created at initialization.

type

{{}}

Type declaration

Constructors

constructor

Hierarchy

  • SearchEndpoint

Implements

  • ISearchEndpoint