Skip to content

Commit 877b134

Browse files
Make tag search precise (#7640)
* fix explicit tag search * update changelog --------- Co-authored-by: MichaelBuessemeyer <[email protected]>
1 parent d58be5e commit 877b134

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
3434
- Fixed small styling errors as a follow up to the antd v5 upgrade [#7612](https://github.com/scalableminds/webknossos/pull/7612)
3535
- Fixed deprecation warnings caused by Antd <Collapse> components. [#7610](https://github.com/scalableminds/webknossos/pull/7610)
3636
- Fixed small styling error with a welcome notification for new users on webknossos.org. [7623](https://github.com/scalableminds/webknossos/pull/7623)
37+
- Fixed that filtering by tags could produce false positives. [#7640](https://github.com/scalableminds/webknossos/pull/7640)
3738

3839
### Removed
3940

frontend/javascripts/dashboard/explorative_annotations_view.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,19 @@ class ExplorativeAnnotationsView extends React.PureComponent<Props, State> {
491491
// (e.g., filtering by owner in the column header).
492492
// Use `this.currentPageData` if you need all currently visible
493493
// items of the active page.
494-
return Utils.filterWithSearchQueryAND(
494+
const filteredTracings = Utils.filterWithSearchQueryAND(
495495
this.getCurrentTracings(),
496496
["id", "name", "modified", "tags", "owner"],
497-
`${this.state.searchQuery} ${this.state.tags.join(" ")}`,
497+
this.state.searchQuery,
498498
);
499+
500+
if (this.state.tags.length === 0) {
501+
// This check is not strictly necessary, but serves
502+
// as an early-out to save some computations.
503+
return filteredTracings;
504+
}
505+
506+
return filteredTracings.filter((el) => _.intersection(this.state.tags, el.tags).length > 0);
499507
}
500508

501509
renderIdAndCopyButton(tracing: APIAnnotationInfo) {

0 commit comments

Comments
 (0)