Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9bf182e

Browse files
authoredJul 28, 2020
Merge pull request #22 from ansaryfantastic/develop
Fixes u-bahn-app #237
2 parents 5a8b326 + 4b602b9 commit 9bf182e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/common/es-helper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ function hasNonAlphaNumeric (text) {
630630
*/
631631
async function searchSkills (keyword) {
632632
const queryDoc = DOCUMENTS.skill
633-
633+
keyword = escapeRegex(keyword)
634634
const query = hasNonAlphaNumeric(keyword) ? `\\*${keyword}\\*` : `*${keyword}*`
635635

636636
const esQuery = {
@@ -655,14 +655,14 @@ async function searchSkills (keyword) {
655655

656656
async function setUserSearchClausesToEsQuery (boolClause, keyword) {
657657
const skillIds = await searchSkills(keyword)
658-
659658
boolClause.should.push({
660659
query_string: {
661660
fields: ['firstName', 'lastName', 'handle'],
662-
query: `*${keyword.replace(/ +/g, ' ').split(' ').join('* OR *')}*`
661+
query: `\\*${escapeRegex(keyword.replace(/ +/g, ' ')).split(' ').join('\\* OR \\*')}\\*`
663662
}
664663
})
665664

665+
keyword = escapeRegex(keyword)
666666
boolClause.should.push({
667667
nested: {
668668
path: USER_ATTRIBUTE.esDocumentPath,

0 commit comments

Comments
 (0)
This repository has been archived.