Try to fix CJK search

This commit is contained in:
Ovler
2022-02-05 23:07:08 +08:00
parent afc691cee7
commit 20990fcf08
+4 -1
View File
@@ -12,7 +12,10 @@ import siteConfig from '../../config/site.config'
* @returns Sanitised query string which replaces non-alphanumeric characters with ' ' * @returns Sanitised query string which replaces non-alphanumeric characters with ' '
*/ */
function sanitiseQuery(query: string): string { function sanitiseQuery(query: string): string {
const sanitisedQuery = query.replace(/[^a-zA-Z0-9]/g, ' ') /** const sanitisedQuery = query.replace(/[^a-zA-Z0-9]/g, ' ')
* Actually this will cause problems with CJK only query words as it will remove every character.
* After removing it, CJK search will be much improved.
*/
return encodeURIComponent(sanitisedQuery) return encodeURIComponent(sanitisedQuery)
} }