Skip to content

Commit

Permalink
Make tag search precise (#7640)
Browse files Browse the repository at this point in the history
* fix explicit tag search

* update changelog

---------

Co-authored-by: MichaelBuessemeyer <[email protected]>
  • Loading branch information
philippotto and MichaelBuessemeyer authored Feb 20, 2024
1 parent d58be5e commit 877b134
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed small styling errors as a follow up to the antd v5 upgrade [#7612](https://github.com/scalableminds/webknossos/pull/7612)
- Fixed deprecation warnings caused by Antd <Collapse> components. [#7610](https://github.com/scalableminds/webknossos/pull/7610)
- Fixed small styling error with a welcome notification for new users on webknossos.org. [7623](https://github.com/scalableminds/webknossos/pull/7623)
- Fixed that filtering by tags could produce false positives. [#7640](https://github.com/scalableminds/webknossos/pull/7640)

### Removed

Expand Down
12 changes: 10 additions & 2 deletions frontend/javascripts/dashboard/explorative_annotations_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,19 @@ class ExplorativeAnnotationsView extends React.PureComponent<Props, State> {
// (e.g., filtering by owner in the column header).
// Use `this.currentPageData` if you need all currently visible
// items of the active page.
return Utils.filterWithSearchQueryAND(
const filteredTracings = Utils.filterWithSearchQueryAND(
this.getCurrentTracings(),
["id", "name", "modified", "tags", "owner"],
`${this.state.searchQuery} ${this.state.tags.join(" ")}`,
this.state.searchQuery,
);

if (this.state.tags.length === 0) {
// This check is not strictly necessary, but serves
// as an early-out to save some computations.
return filteredTracings;
}

return filteredTracings.filter((el) => _.intersection(this.state.tags, el.tags).length > 0);
}

renderIdAndCopyButton(tracing: APIAnnotationInfo) {
Expand Down

0 comments on commit 877b134

Please sign in to comment.