API Docs for: 2.0.20133.2
Show:

api.search Class

Module: API Search
Parent Module: API

Search API to get search results for support

Methods

convertDatesToStrings

()

Converts Date to an ISO string to make it easier for jQuery.param to serialize. Only modifies top level attributes

Example:

convertDatesToStrings({"filter.documentDateFrom": new Date("2016-01-15") }); // returns {"filter.documentDateFrom":"2016-01-15T00:00:00.000Z"}

flatten

()

Helper to flatten nested objects to a single level, modified for our api see https://stackoverflow.com/a/49042916/198348 for a reference

Example:

flatten({ "query": "double click", "locale": "en-us,fr-fr,ja-jp", "scopes": "default", "count": "10", "version": "6.0", "suggestId": "", "filter": { "documentDateFrom": new Date("2016-01-15"), "documentDateTo": new Date("2018-09-24"), "contentType": [ "Article", "QnA" ] }, "facets": { "confidentiality": { "count": null }, "contentType": { "count": 10 }, "language": { "count": null } }, "orderBy": [ { "name": OrderByFieldNames.DocumentDate, "direction": OrderByDirection.Descending }, { "name": OrderByFieldNames.SearchScore, "direction": OrderByDirection.Ascending } ] });

// returns this: // { // "query": "double click", // "locale": "en-us,fr-fr,ja-jp", // "scopes": "default", // "count": "10", // "skip": "", // "version": "6.0", // "suggestId": "", // "filter.documentDateFrom": new Date("2016-01-15"), // "filter.documentDateTo": new Date("2018-09-24"), // "filter.contentType[0]": "Article", // "filter.contentType[1]": "QnA", // "facets.confidentiality.count": null, // "facets.contentType.count": 10, // "facets.language.count": null, // "orderBy[0].name": OrderByFieldNames.DocumentDate, // "orderBy[0].direction": OrderByDirection.Descending, // "orderBy[1].name": OrderByFieldNames.SearchScore, // "orderBy[1].direction": OrderByDirection.Ascending // }

formSearchUrl

(
  • config
)
private static

Forms the params to send to the search endpoint

Parameters:

  • config SearchConfig

    A search config object

formSearchUrl

(
  • config
  • knowledgeSearch
)
private static

Forms the search endpoint URL

Parameters:

  • config SearchConfig

    A search config object

  • knowledgeSearch Bool

    Flag indicates whether to use knowledge search

getKnowledgeSearchResults

(
  • config
)
Promise | KnowledgeSearchResultSet static

Retrieves knowledge search results for the parameters specified

Parameters:

  • config KnowledgeSearchConfig

    A config object to enlist the input criteria.

    • httpMethod. HttpMethod

      HTTP Method to use. Valid options are GET and POST (defaults to GET).

    • query. String

      Search query.

    • locale. String

      Comma delimited locale for search results.

    • scopes. String

      Comma delimited scopes for the search results.

    • count. Number

      Total number of search results to be returned.

    • skip. Number

      A subset/multiplier of count that needs to be returned in every call.

    • searchProvider. String

      The search provider to be used to perform the search.

    • instantAnswerProvider. String

      Instant answer provider to be used.

    • includeInstantAnswers. Boolean

      Include instant answers along with search results.

    • includeWebSearchResults. Boolean

      Include web search results.

    • enableHitHighlights. Boolean

      Enable hit highlights.

    • tenant. String

      Specify tenant to be used.

    • filter. SearchFilter

      The filter to apply for the search results.

    • facets. SearchFacets

      The facets to apply for the search results.

    • orderBy. SearchOrderByExpression

      The order by expressions to apply for the search results.

    • version. String

      Targeting a specific version.

    • flights. String[]

      The flights the call should use.

    • suggestId. String

      The suggest id to correlate to this search.

    • environment. String

      The environment to use (staging or production), default is production.

    • insiderMode. String

      Insider mode for on-boarding onto Alpha development.

    • muid. String

      Muid for the current user.

    • token. String

      An authentication token from AAD

    • searchId. String

      The search id used to track the virtual session

Returns:

Promise | KnowledgeSearchResultSet:

. Promise of knowledge search results.

getSearchResults

(
  • config
)
Promise | SearchResultSet static

Retrieves search results for the parameters specified

Parameters:

  • config SearchConfig

    A config object to enlist the input criteria.

    • httpMethod. HttpMethod

      HTTP Method to use. Valid options are GET and POST (defaults to GET).

    • query. String

      Search query.

    • locale. String

      Comma delimited locale for search results.

    • scopes. String

      Comma delimited scopes for the search results.

    • count. Number

      Total number of search results to be returned.

    • skip. Number

      A subset/multiplier of count that needs to be returned in every call.

    • searchProvider. String

      The search provider to be used to perform the search.

    • instantAnswerProvider. String

      Instant answer provider to be used.

    • includeInstantAnswers. Boolean

      Include instant answers along with search results.

    • includeWebSearchResults. Boolean

      Include web search results.

    • enablehithighlights. Boolean

      Enable hit highlights.

    • tenant. String

      Specify tenant to be used.

    • filter. SearchFilter

      The filter to apply for the search results.

    • facets. SearchFacets

      The facets to apply for the search results.

    • orderBy. SearchOrderByExpression

      The order by expressions to apply for the search results.

    • version. String

      Targeting a specific version.

    • flights. String[]

      The flights the call should use.

    • suggestId. String

      The suggest id to correlate to this search.

    • environment. String

      The environment to use (staging or production), default is production.

    • insiderMode. String

      Insider mode for on-boarding onto Alpha development.

    • muid. String

      Muid for the current user.

    • searchId. String

      The search id tracking the virtual session.

Returns:

Promise | SearchResultSet:

. Promise of search results.

postKnowledgeSearchResults

(
  • config
)
static

Retrieves knowledge search results for the parameters specified via HTTP POST by default

Parameters:

  • config KnowledgeSearchConfig

    A config object to enlist the input criteria.

postSearchResults

(
  • config
)
static

Retrieves search results for the parameters specified via HTTP POST by default

Parameters:

  • config SearchConfig

    A config object to enlist the input criteria.