Lambda based fuzzy matching function with mutable terms dictionary
Deployment and development of the function requires serverless & dep.
$ npm install -g serverless
On Mac, installing dep would look something like this.
$ brew install dep
$ make build
$ make deploy
$ make deploy-prod
Detailed request and response information for API
Return all matched terms against dictionary
GET /prod/match?q=Ammo& q=I sell ammunition HTTP/1.1
200 OK - Response
[
{
"query": "Ammo",
"terms": [
"Ammo",
"Ammunition"
]
}
]
GET /prod/match?q=Puppies& q=I sell puppies HTTP/1.1
204 No Content - Response
...
Return all terms used in fuzzy matching along with the date they were last modified
GET /prod/terms HTTP/1.1
200 OK - Response
{
"modified": 1572891670,
"terms": [
"420",
"Adult",
"Airline",
"Ammo"
...
]
}
Add additional terms to terms dictionary and return updated dictionary
POST /prod/terms HTTP/1.1
Content-Type: application/json
Content-Length: 189
{
"terms": [
"Coffee",
"Theft"
]
}
200 OK - Response
{
"modified": 1572893178,
"terms": [
"420",
"Adult",
"Airline",
"Ammo",
...
"Coffee",
"Theft"
]
}
Replace all terms in dictionary and return updated dictionary
POST /prod/terms HTTP/1.1
Content-Type: application/json
Content-Length: 167
{
"terms": [
"Island",
"Epstein"
]
}
200 OK - Response
{
"modified": 1572893446,
"terms": [
"Island",
"Epstein"
]
}