Skip to content

Commit a550c94

Browse files
author
Conan Crawford
committed
change default settings for better results
1 parent 77903b1 commit a550c94

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ see: [Fuse.js](http://fusejs.io/) for demo
6565
| searchPrimaryKey | Also search the primary key | false |
6666
| location | Approximately where in the text is the pattern expected to be found | 0 |
6767
| distance | Determines how close the match must be to the fuzzy location | 100 |
68-
| threshold | **0.0** requires a perfect match, and a threshold of **1.0** would match anything | 0.6 |
68+
| threshold | **0.0** requires a perfect match, and a threshold of **1.0** would match anything | 0.3 |
6969
| maxPatternLength | Machine word size | 32 |
7070
| caseSensitive | Indicates whether comparisons should be case sensitive | false |
7171
| tokenSeparator | Regex used to separate words when searching. Only applicable when **tokenize** is **true** | / +/g |
7272
| findAllMatches | When true, the algorithm continues searching to even if a perfect match is found | false |
7373
| minMatchCharLength | Minimum number of characters that must be matched before a result is considered a match | 1 |
7474
| keys | An array of fields (columns) to be included in the search | Model.$fields() |
7575
| shouldSort | Whether to sort the result list, by score | false |
76-
| tokenize | When true, the search algorithm will search individual words **and** the full string, computing the final score as a function of both. **Note**: that when _tokenize_ is _true_, the **threshold**, **distance**, and **location** are inconsequential for individual tokens | true |
76+
| tokenize | When true, the search algorithm will search individual words **and** the full string, computing the final score as a function of both. **Note**: that when _tokenize_ is _true_, the **threshold**, **distance**, and **location** are inconsequential for individual tokens | false |
7777
| matchAllTokens | When true, the result set will only include records that match all tokens. Will only work if **tokenize** is also true. **Note**: It is better to use multiple **.search()** query chains if you have multiple terms that need to match. | false |
7878
| verbose | Will print to the console. Useful for debugging. | false |
7979

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import Fuse from 'fuse.js'
22

33
export const defaultOptions = {
44
searchPrimaryKey: false,
5-
tokenize: true,
5+
tokenize: false,
66
shouldSort: false,
7-
threshold: 0.6,
7+
threshold: 0.3,
88
location: 0,
99
distance: 100,
1010
maxPatternLength: 32,
1111
minMatchCharLength: 1,
1212
verbose: false,
13+
debug: false,
1314
keys: []
1415
}
1516

@@ -46,6 +47,11 @@ const plugin = {
4647
}
4748
}
4849
options.keys = searchKeys
50+
if (options.debug) {
51+
console.log('---- SEARCH OPTIONS ----')
52+
console.log(options)
53+
console.log('------------------------')
54+
}
4955
const records = this.query.records
5056
const fuse = new Fuse(records, options)
5157
try {

0 commit comments

Comments
 (0)