Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 5a8b326

Browse files
Merge pull request #21 from ansaryfantastic/develop
Fixes u-bahn-app #487
2 parents 8604c99 + 5e34f06 commit 5a8b326

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/common/es-helper.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@ function getTotalCount (total) {
268268
return typeof total === 'number' ? total : total.value
269269
}
270270

271-
function escapeRegex(str) {
272-
return str
273-
.replace(/[\*\+\-=~><\"\?^\${}\(\)\:\!\/[\]\\\s]/g, '\\$&') // replace single character special characters
274-
.replace(/\|\|/g, '\\||') // replace ||
275-
.replace(/\&\&/g, '\\&&') // replace &&
276-
.replace(/AND/g, '\\A\\N\\D') // replace AND
277-
.replace(/OR/g, '\\O\\R') // replace OR
278-
.replace(/NOT/g, '\\N\\O\\T'); // replace NOT
271+
function escapeRegex (str) {
272+
return str
273+
.replace(/[\*\+\-=~><\"\?^\${}\(\)\:\!\/[\]\\\s]/g, '\\$&') // replace single character special characters
274+
.replace(/\|\|/g, '\\||') // replace ||
275+
.replace(/\&\&/g, '\\&&') // replace &&
276+
.replace(/AND/g, '\\A\\N\\D') // replace AND
277+
.replace(/OR/g, '\\O\\R') // replace OR
278+
.replace(/NOT/g, '\\N\\O\\T') // replace NOT
279279
}
280280

281281
async function getOrganizationId (handle) {
@@ -583,7 +583,6 @@ function setUserAttributesFiltersToEsQuery (filterClause, attributes) {
583583
attribute.value = [attribute.value]
584584
}
585585

586-
587586
filterClause.push({
588587
nested: {
589588
path: USER_ATTRIBUTE.esDocumentPath,
@@ -660,7 +659,7 @@ async function setUserSearchClausesToEsQuery (boolClause, keyword) {
660659
boolClause.should.push({
661660
query_string: {
662661
fields: ['firstName', 'lastName', 'handle'],
663-
query: `*${keyword.replace(/ +/g, ' ').split(' ').join('* AND *')}*`
662+
query: `*${keyword.replace(/ +/g, ' ').split(' ').join('* OR *')}*`
664663
}
665664
})
666665

0 commit comments

Comments
 (0)