Challenge Overview
Challenge Objectives
-
Improve the searching capabilities of the API based on the requirements below.
Tech Stack
-
Node.js
-
DynamoDB
-
ElasticSearch
-
Docker
Code Access
Repos:
Branch: develop
Detailed requirements
As part of this challenge, you need to update the GET /challenges endpoint to improve the searching capabilities.
1. Update the `name` and `description` query parameters
Currently, the `name` and `description` query parameters are being used with the ElasticSearch Match Query.
The problem with that is that it doesn’t support partial matches. You need to search for the exact word/string that is contained in the challenge name/description.
For example, the following call http://api.topcoder-dev.com/v5/challenges?name=term does not return challenges where the name contains the word “terms”.
You need to explore the available approaches and select the best that supports:
-
Partial matches
-
Full matches
-
Case insensitive matches
Another example, searching with `?name=skill builder` should pull up the “Skill Builder” challenges but also searching for `?name=builder` or `?name=build` should pull up the “Skill Builder” challenges.
We do not want to simply use the `Wildcard` query (eg: { wildcard: { name: ‘*builder*’ } } as this does not seem to have worked correctly in the past).
Results should also have a weight based on how many times the searched term shows up.
2. Generic `search` query
You need to add support for a new `search` query parameter on the GET /challenges endpoint that will search across the challenge name, description, and tags.
The `search` parameter should follow the same practices with the updated `name` and `description` and its query must match with at least one of the `name`, `description`, or `tags`.
For example, the following call http://api.topcoder-dev.com/v5/challenges?search=node should return results that:
-
May contain the tag `Node.js`
-
May have the word `Node` in their name (eg `Implement a Node.js API`)
-
May contain the word `node` in their description
The above are a few example matches.
You also need to update the POSTMAN collection and the Swagger definition to reflect the changes made during this challenge.
Should you have any doubts, please post your questions in the challenge forum.