minisearch
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -5,2 +5,6 @@ # Changelog | ||
# v4.0.2 | ||
- [fix] Fix match data on mixed prefix and fuzzy search | ||
# v4.0.1 | ||
@@ -7,0 +11,0 @@ |
{ | ||
"name": "minisearch", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Tiny but powerful full-text search engine for browser and Node", | ||
@@ -5,0 +5,0 @@ "main": "dist/umd/index.js", |
@@ -82,3 +82,3 @@ # MiniSearch | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/minisearch@4.0.1/dist/umd/index.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/minisearch@4.0.2/dist/umd/index.min.js"></script> | ||
``` | ||
@@ -85,0 +85,0 @@ |
@@ -751,2 +751,16 @@ /* eslint-env jest */ | ||
it('reports correct info for many fuzzy and prefix queries', () => { | ||
const results = ms.search('vi nuova m de', { fuzzy: 0.2, prefix: true }) | ||
expect(results.map(({ match }) => match)).toEqual([ | ||
{ del: ['text'], della: ['text'], memoria: ['text'], mia: ['text'], vita: ['title', 'text'], nova: ['title'] }, | ||
{ del: ['text'], mezzo: ['text'], vita: ['text'] }, | ||
{ del: ['text'] } | ||
]) | ||
expect(results.map(({ terms }) => terms)).toEqual([ | ||
['vita', 'nova', 'memoria', 'mia', 'della', 'del'], | ||
['vita', 'mezzo', 'del'], | ||
['del'] | ||
]) | ||
}) | ||
it('passes only the query to tokenize', () => { | ||
@@ -753,0 +767,0 @@ const tokenize = jest.fn(string => string.split(/\W+/)) |
@@ -1133,6 +1133,13 @@ import SearchableMap from './SearchableMap/SearchableMap' | ||
const result = results.get(documentId) | ||
if (result) { | ||
result.score += score | ||
const match = getOwnProperty(result.match, term) | ||
if (match) match.push(field) | ||
result.score += score | ||
if (match) { | ||
match.push(field) | ||
} else { | ||
result.match[term] = [field] | ||
result.terms.push(term) | ||
} | ||
} else { | ||
@@ -1139,0 +1146,0 @@ results.set(documentId, { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
724607
11734