Skip to content

Commit

Permalink
fix(contentful): minor fix in similar-words check
Browse files Browse the repository at this point in the history
  • Loading branch information
dpinol committed Oct 29, 2019
1 parent c3941f2 commit 3d777f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/botonic-plugin-contentful/src/nlp/similar-words.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ class FindMixedUp extends CandidateFinder {
}
// in case the space between the words in the keyword is missing
if (
!submatches ||
(submatches.length == 0 && keyword.raw.includes(' '))
(!submatches || submatches.length == 0) &&
keyword.raw.includes(' ')
) {
const wordsWithoutSpace = this.substring.findKeyword(
keyword,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ test('TEST search: ', async () => {
es: new KeywordsOptions(1)
});
const res = await sut.searchByKeywords(
'esta',
MatchType.ONLY_KEYWORDS_FOUND,
'mi pedido no encuentro',
MatchType.ALL_WORDS_IN_KEYWORDS_MIXED_UP,
{
locale: 'es'
}
);
console.log(res);
expect(res.length).toBeGreaterThanOrEqual(1);
expect(res.filter(res => res.common.name == 'POST_FAQ1')).toHaveLength(1);
});

0 comments on commit 3d777f4

Please sign in to comment.