Closed skalee closed 3 years ago
Thanks @skalee , feel free to merge when ready.
There is a problem with Unicode property escapes in regular expressions like /\p{Letter}+/ug
, which are supported in modern browsers only, and which Babel is unable to rewrite using older syntax. Unfortunately, in JavaScript \w
does not match non-Latin characters, not even in Unicode mode.
This probably can be worked around by defining a set of usual separator characters (\s
, -
, etc.), but if possible, I'd rather find some way to make Unicode property escapes working. I don't know yet, maybe it's just a matter of reconfiguring Babel or something.
That's why it's a draft. Apart from that, it works.
Looks like in the meantime they've added a new plugin (https://www.npmjs.com/package/@babel/plugin-proposal-unicode-property-regex) to Babel and since then it works even in IE10.
In search, match every word of the query separately. This solves issues with reordered or missing words in a search query, which used to prevent terms from being matched. Fixes #131.
This pull request brings also some code-style improvements: SearchQuery class has been extracted to contain added logic, and
string.indexOf()
has been replaced withstring.includes()
.