- 
                Notifications
    You must be signed in to change notification settings 
- Fork 192
feat: adds fuzzy search and adds serbian translation #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| @sokumon can you check? | 
| }; | ||
| } | ||
|  | ||
| const filterMatchStrategy = data && data.options && data.options.filterMatchStrategy; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const filterMatchStrategy = data && data.options && data.options.filterMatchStrategy; | |
| const filterMatchStrategy = data?.options?.filterMatchStrategy'; | 
| } | ||
|  | ||
| function guessFilter(keyword = '') { | ||
| function guessFilter(keyword = '', data) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only the strategy is used here, then in my opinion, there's no need to pass the whole data object — you can just pass the strategy directly and set its default value to 'strict'
| if (filterMatchStrategy === 'fuzzy' && keyword.includes(' ')) { | ||
| return { | ||
| type: 'fuzzy', | ||
| text: compareString.toLowerCase() | ||
| }; | ||
| } | ||
| if (filterMatchStrategy === 'tokens' && keyword.includes(' ')) { | ||
| return { | ||
| type: 'tokens', | ||
| text: compareString.toLowerCase() | ||
| }; | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only difference between this and the return statement below is the type value. You could simplify the logic by assigning the type to a variable and defaulting it to 'contains'.
| @ikslavok Thanks for your work. Will you implement the review comments? Would love for this to be merged. | 
This PR gives ability to provide aditional option that defines how columns will be filtered when using search functionality.
filterMatchStrategy: 'strict', // strict, fuzzy, tokens