Vuepress: Change search plugin regular expression to support non-latin characters

Created on 22 Mar 2020  路  8Comments  路  Source: vuejs/vuepress


Feature request



What problem does this feature solve?

This add non-latin support for search plugin.

What does the proposed API look like?

It's not going to change API.

How should this be implemented in your opinion?

Now search plugin use this regex: (?=.*\bWORD\b) and it works for latin words but not for non-latin ones and this is about \b word boundaries.
We can use this alternative way to support both latin and non-latin characters:
(?=.*(?<=\s|^)WORD(?=\s|$))

Are you willing to work on this yourself?

Yes.

contribution welcome good first issue has PR regression

All 8 comments

Introduced by #1557

Contribution welcome

hi @meteorlxy @Alizadeh118
I have made a PR for this Issue.

@ThaddeusJiang

Hey, I just reviewed your solution. That may break current logic for English words.

I just made an alternative PR #2283 for this.

Hi @meteorlxy

As my test, nothing was broken.
Could you share your test case?

CleanShot 2020-04-06 at 15 01 24

@ThaddeusJiang

image

@meteorlxy Is it incorrect?

Before your change, it won't match ready. It's the logic for English word in #1557

Thank you, I understand that it didn't match ready before my change.

I read #1557, I view the improvement is

search can now take in multiple words separated by a space.

not relate fuzzy query.


BTW, Could we support fuzzy query?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

herrbischoff picture herrbischoff  路  3Comments

genedronek picture genedronek  路  3Comments

cfjedimaster picture cfjedimaster  路  3Comments

tinchox5 picture tinchox5  路  3Comments

higuoxing picture higuoxing  路  3Comments