Skip to content

Lambda based fuzzy matching function with mutable terms dictionary

Notifications You must be signed in to change notification settings

maxmclau/fuzzy-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

λ Fuzzy Service

Built for SumUp

Lambda based fuzzy matching function with mutable terms dictionary

Installation

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

Build

$ make build

Deploy

$ make deploy
$ make deploy-prod

API

Detailed request and response information for API

GET /match

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
...

GET /terms

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"
        ...
    ]
}

POST /terms

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"
    ]
}

PUT /terms

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"
    ]
}

Links

Serverless Framework example for Golang and Lambda

Serverless Examples

About

Lambda based fuzzy matching function with mutable terms dictionary

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published