Skip to content

Commit 797630f

Browse files
upgrade fuse to latest version (#1559)
* upgrade fuse to allow search with longer 32 characters
1 parent 2524420 commit 797630f

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

package-lock.json

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"enzyme-adapter-react-16": "^1.15.7",
4242
"file-saver": "^1.3.3",
4343
"focus-trap": "^6.5.0",
44-
"fuse.js": "^3.3.0",
44+
"fuse.js": "^7.0.0",
4545
"graphiql": "1.11.5",
4646
"graphql": "^15.0.0",
4747
"graphql-language-service-interface": "^2.8.2",

src/DataDictionary/search/DictionarySearcher/searchHelper.js

-7
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ export const searchKeyword = (searchData, keyword) => {
5151
errorMsg: ERR_KEYWORD_TOO_SHORT,
5252
};
5353
}
54-
// 32 is length limitation of Fuse search library
55-
if (keyword.length > 32) {
56-
return {
57-
result: [],
58-
errorMsg: ERR_KEYWORD_TOO_LONG,
59-
};
60-
}
6154
const halfLength = Math.round(keyword.length / 2);
6255
const minMatchCharLength = Math.min(Math.max(halfLength, 10), keyword.length);
6356
const options = {

src/DataDictionary/search/DictionarySearcher/searchHelper.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
searchKeyword,
44
getSearchSummary,
55
ERR_KEYWORD_TOO_SHORT,
6-
ERR_KEYWORD_TOO_LONG,
6+
ERR_KEYWORD_TOO_LONG, ZERO_RESULT_FOUND_MSG,
77
} from './searchHelper';
88

99
describe('dictionary search helper', () => {
@@ -78,6 +78,6 @@ describe('dictionary search helper', () => {
7878
it('can output error if keyword too long', () => {
7979
const { result, errorMsg } = searchKeyword(searchData, '1234567890123456789012345678901234567890');
8080
expect(result).toEqual([]);
81-
expect(errorMsg).toEqual(ERR_KEYWORD_TOO_LONG);
81+
expect(errorMsg).toEqual(ZERO_RESULT_FOUND_MSG);
8282
});
8383
});

0 commit comments

Comments
 (0)