Skip to content

Commit

Permalink
DDF-6037 Correct Tokenized Filter Behavior (#6038)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennuttle authored Jun 1, 2020
1 parent ed5503a commit 25a9d11
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions ui/packages/catalog-ui-search/src/main/webapp/js/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,19 @@ function checkToken(token, filter) {
}

function matchesILIKE(value, filter) {
const valueToCheckFor = filter.value.toLowerCase()
filter.value = filter.value.toLowerCase()
value = value.toString().toLowerCase()
const tokens = value.split(' ')
for (let i = 0; i <= tokens.length - 1; i++) {
if (checkToken(tokens[i], valueToCheckFor)) {
return true
}
}
return false
return matchesLIKE(value, filter)
}

function matchesLIKE(value, filter) {
const valueToCheckFor = filter.value
const tokens = value.toString().split(' ')
for (let i = 0; i <= tokens.length - 1; i++) {
if (checkToken(tokens[i], valueToCheckFor)) {
return true
}
if (!filter.value.startsWith('*')) {
filter.value = '*' + filter.value
}
return false
if (!filter.value.endsWith('*')) {
filter.value = filter.value + '*'
}
return checkToken(value, filter.value)
}

function matchesEQUALS(value, filter) {
Expand Down

0 comments on commit 25a9d11

Please sign in to comment.