1.0.0 • Published 4 years ago

sky-search-api v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Sky Search API

This API collates, caches and surfaces data related to user search queries for sky.com. The API has been built as part of the work to improve the user experience for customers using search in masthead and is a work in progress.

The API is built using Javascript, Node & Koa.

When using the search API, it will call the following upstream APIs

Caching

Responses are cached in redis with the search term used as a key. This ensures that future responses for common terms are fast.

The exception to caching is when riri returns an intent for watch, but returns no results. This is a known issue with riri and to stop us from caching incorrect responses, we ignore this situation.

URL parameters

  • term (string) the search term that you would like the API to return results for. Eg: <api_url>?term=broadband

Response

As the API uses the intent detection service (SID+) baked in to riri, response shapes can change depending on the calculated intent of the search. Possible properties on the response object are:

  • helpArticles - the top 5 articles returned by the help suggest API. If no results are found here, the top 5 results from riri help will be included
  • shopArticles - The top 5 results related to products and packages
  • watchContent - The top 3 results for matching programmes including the brands they are associated with
  • editorialLayer - a section containing content implemented by the editorial team for top key phrases to be highlighted.

Deployments

Working deployments of the API can be found here:

  • dev sky-search-api-master-e05.cf.dev-paas.bskyb.com
  • stage sky-search-api-master-n01.cf.stage-paas.bskyb.com
  • prod-offline sky-search-api-offline.cf.paas.bskyb.com
  • prod (TBC)

CI

We use team city for deployments and the project can be found here

Running locally

As the application uses a redis service, we recommend using docker to run locally.

After cloning the codebase, simply run docker-compose up. This will build and start the API layer and the Redis service. The dev server will be exposed on localhost:3000 with hot reloading.

Search UI

If you wish to use this service to display search results to users via an input field, you may be interested in this component which consumes the API and is compatible with any Javascript enabled application or webpage.

Maintainers

This API is maintained by the manage squad in online service (Leeds)