Give it a try! at
Up and running
- if you want to perform a search by day write somthing like: thu mon sat
- if you want to perform a search by month write somthing like: jun dec feb
- if you want to perform a search by amount write somthing like: 0.45
- if you want to perform a search by creditcard write somthing like: 2544
At src/services/EditDistances.js!
I thougth that the Edit distance algorithm was the algorithm which best solve fuzzy search problem.
The function editDistance returns the edit distance between two string in this case the search input and the content of every field
of a transaction object.
In oder to calculate the edit distance the editDistance function takes 6 steps.
-
Set n to be the length of s (inputText).
Set m to be the length of t (any content of a transaction's field).
If n = 0, return m and exit.
If m = 0, return n and exit.
Construct a matrix containing 0..m rows and 0..n columns.\ -
Initialize the first row to 0..n.
Initialize the first column to 0..m. -
Examine each character of s (i from 1 to n).
-
If s[i] equals t[j], the cost is 0.
If s[i] doesn't equal t[j], the cost is 1. -
Set cell d[i,j] of the matrix equal to the minimum of:
a. The cell immediately above plus 1: d[i-1,j] + 1.
b. The cell immediately to the left plus 1: d[i,j-1] + 1.
c. The cell diagonally above and to the left plus the cost: d[i-1,j-1] + cost. \ -
After the iteratio
At src/services/EditDistances.js!
The search function returns a list of transactions which follow
the criteria below:
- If search input.length === "" returns all the transactions.
- For date field returns true if the input search is a substring of date field.
- For amount field returns true if the edit distance between search input and the current transaction's amount < amount.length
- For the credit card field return true if the edit distance between search input and the current credit card field < 3
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# run test
npm test
For detailed explanation on how things work, consult the docs for vue-loader.