diff --git a/src/__tests__/query-tests.ts b/src/__tests__/query-tests.ts index fc2fdec..28f0271 100644 --- a/src/__tests__/query-tests.ts +++ b/src/__tests__/query-tests.ts @@ -40,6 +40,14 @@ describe('The Query class', () => { ).toBeTruthy() }) + it('should not exclude words when there is no space before', () => { + // Act + const query = new Query('foo bar-baz') + + // Assert + expect(query.exclusions).toHaveLength(0) + }) + describe('.getExactTerms()', () => { it('should an array of strings containg "exact" values', () => { // Act diff --git a/src/search.ts b/src/search.ts index 6c8716a..ea14ee6 100644 --- a/src/search.ts +++ b/src/search.ts @@ -183,7 +183,7 @@ export async function getSuggestions( else results = [] } else { - results = results.sort((a, b) => b.score - a.score).slice(0, 50) + results = results.slice(0, 50) } // Map the raw results to get usable suggestions