Skip to content

Commit

Permalink
Merge pull request #1272 from girder/fix-multi-clause-filter
Browse files Browse the repository at this point in the history
Fix filtering item lists in Girder by multiple phrases
  • Loading branch information
manthey authored Aug 22, 2023
2 parents 4b156d0 + c19097b commit ec430e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

### Bug Fixes
- Allow users with only annotation access to edit annotations ([#1267](../../pull/1267))
- Fix filtering item lists in Girder by multiple phrases ([#1272](../../pull/1272))

## 1.23.3

Expand Down
6 changes: 3 additions & 3 deletions girder/girder_large_image/web_client/views/itemList.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ wrap(ItemListWidget, 'render', function (render) {
}
});
}
const key = `${coltag}:` + phrases.join('|||');
const key = `${coltag || ''}:` + phrases.map((p) => p.phrase + (p.exact ? '__exact__' : '')).join('|||');
if (!phrases.length || usedPhrases[key]) {
return;
}
Expand Down Expand Up @@ -301,12 +301,12 @@ wrap(ItemListWidget, 'render', function (render) {
if (key && exact) {
clause.push({[key]: {$regex: '^' + phrase + '$', $options: 'i'}});
if (!_.isNaN(numval)) {
clause.push({[key]: {$eq: numval}});
clause.push({[key]: numval});
}
} else if (key) {
clause.push({[key]: {$regex: phrase, $options: 'i'}});
if (!_.isNaN(numval)) {
clause.push({[key]: {$eq: numval}});
clause.push({[key]: numval});
if (numval > 0 && delta) {
clause.push({[key]: {$gte: numval, $lt: numval + delta}});
} else if (numval < 0 && delta) {
Expand Down

0 comments on commit ec430e3

Please sign in to comment.