AboutSupportDeveloper GuideVersion 17.2.13

Interface SearchListenerResponse

Representation of a search response from a specific invocation of a SearchProvider's onUserInput listener function. Can optionally be used to push search results to the requester.

function onUserInput(searchListenerRequest, searchListenerResponse) {
searchListenerResponse.open();

const myLongRunningQuery = makeMyLongRunningQuery(searchListenerRequest.query);
myLongRunningQuery.onNewResults(myNewResults => {
searchListenerResponse.respond(myNewResults);
});

searchListenerRequest.onClose(() => {
myLongRunningQuery.close();
});
}

Hierarchy

  • SearchListenerResponse

Methods

  • Experimental

    Close the response stream. This notifies the requester that the current search provider is done sending results.

    import type { SearchListenerResponse } from './my-shape-definition';
    function closeStream(request:SearchListenerRequest, response:SearchListenerResponse) {
    response.close();
    }

    closeStream();

    Returns void

  • Experimental

    Open the response stream, notifying the search requester that there are new or updated search results that have yet to be pushed by the current provider.

    import type { SearchListenerResponse } from './my-shape-definition';
    function openStream(response:SearchListenerResponse) {
    response.open();
    }

    openStream();

    Returns void

  • Experimental

    Respond to the search request with new or updated search results.


    response.respond([
    { name: 'result-1' },
    { name: 'result-2' },
    { name: 'result-3' },
    ]);

    Parameters

    Returns void

  • Experimental

    Remove a search result from the list of responded search results.

    response.revoke({ name: 'result-1' }, { name: 'result-2' });
    

    Parameters

    • Rest ...resultKeys: string[]

      the keys of the search results to revoke.

    Returns void

  • Respond to the search request with new or updated search results context.

    Parameters

    • context: any

      The new or updated search result context to respond with.

    Returns void