Skip to content

Conversation

@sharadsw
Copy link
Contributor

@sharadsw sharadsw commented Feb 18, 2025

EDITED by @melton-jason: Updated PR Description and added Testing Instructions

Fixes #6253

Old PR Description

Adds a filter for including only COs that use the selected COT formatter.

NOTE: This means the results are filtered by formatter name rather than COT name.
If a COT formatter matches the collection's default catalog number formatter, the results will include those COs as well even if they belong to a different COT with no specified catalogNumberFormatName

This PR makes it so that when a CatalogNumber format is selected in the QueryBuilder, if there are no other filters to the CollectionObject's CollectionObjectType, it adds a Type -> Name filter to the Query below the CatalogNumber query field

cot_type_to_query.mov

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone
  • Add relevant documentation (Tester - Dev)

Testing instructions

Testing instructions coming soon

@sharadsw sharadsw added this to the 7.10.2 milestone Feb 18, 2025
Copy link
Contributor

@melton-jason melton-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation! This does resolve #6253!

Although, I am a little hesitant in always enforcing the filter on the backend.
This change might make it difficult for users to arbitrarily search for Collection Objects which have similar, but different CollectionObjectType catalogNumber formatters.

For example, consider there are two formats, one of NNNN#####, and one ######### where N is a non-incrementing digit and # is an incrementing digit- each of which are invalid against the collection default format, AAA-##### where A is any letter.

With this setup, there is no way for a user to search across all of their "numeric" CollectionObjects without adding a duplicate filter for each numeric formatter, as demonstrated in the below video:

Screen.Recording.2025-02-23.at.11.58.16.PM.mov

This exact setup is probably pretty unlikely, but how likely is the generalization of the problem?
Will users want or expect to generically search across CollectionObjects using catalogNumber without the results being restricted to which field format(s) they used for catalogNumber?

If this is the case, it is somewhat contradictory to the Issue mentioned in #6253 (comment), but I think the problem mentioned above (being too restrictive when filtering) could potentially be just as detrimental as the ones pointed out in #6253 (comment) (being too open when filtering).

If this would be a problem with users, would something like the following solution be sufficient to solve both Issues?
Instead of restricting the results in the backend based on the format name of the catalogNumber filter(s), maybe we could instead add a CollectionObjectType -> Name filter to the query on the frontend whenever the user explicitly chooses a catalogNumber format via the ⚙️ button.

So if the user wants to search on CollectionObjects using the Numeric and ByYear COT catalogNumber formats, we add a COT -> Name -> In filter for each format they select using the ⚙️ button.

Screenshot 2025-02-21 at 12 54 05 PM

That way, we're very clear in letting the user know that the results will be restricted to COs with those COTs, and they still have the option to modify the filter before running the query; so the restriction in filtering by COTs based on the format(s) they're using is still the default, but entirely configurable.

@grantfitzsimmons
Copy link
Member

@melton-jason

I agree with your suggestion to add a ⁠CollectionObjectType → Name filter to the frontend query when a user selects a catalog number format is spot on. Users can then have the best of both worlds—they can still choose specific formats while clearly understanding how their results are being filtered. I don't like the idea that we are adding another filter to the query just because they select a format, but if UX feels this is the most intuitive, I am willing to be flexible.

In my view, Jason's approach not only gives users the flexibility they need but also keeps the search process largely intuitive and user-friendly. We just need to make sure our users can easily find what they’re looking for, and Jason's solution seems like a great way to achieve that.

@CarolineDenis CarolineDenis linked an issue Feb 28, 2025 that may be closed by this pull request
Base automatically changed from issue-6239 to production March 5, 2025 14:45
@CarolineDenis CarolineDenis modified the milestones: 7.10.2, 7.10.3 Mar 14, 2025
@melton-jason melton-jason self-assigned this Mar 26, 2025
@melton-jason
Copy link
Contributor

melton-jason commented Apr 1, 2025

The main "core" of this feature is implemented!

qb_auto_cot_filter.mov

Some notes/documentation on the current behavior of the feature:

  • If there is any filter to CollectionObjectType on the same CollectionObject as the CatalogNumber filter, no filter for the CollectionObjectType will be added
  • Apart from the main "domain" endpoint (which was cached already), no more of the cache is used. Meaning:
    • The user does not have to reload the page once they make changes to CollectionObjectTypes, and there should be no weird behavior when switching between different instances.
    • However, this does result in longer load times when using the feature, and a more complex implementation in the sense that the component now has to handle the case of waiting for results to return from the backend

@specify/ux-testing @specify/dev-testing
I'm a little uncertain how intuitive and helpful a feature like this would be. Would something like this lead to more confusion and be more harmful than helpful?

If I'm understanding correctly, the initial problem was that it wasn't initially clear what the "Select Formatter" option next to CatalogNumber was doing or supposed to do. More specifically, it could be taken that selecting a format for CatalogNumber would alter the results of the Query, which is not the case.
With the changes from #6252 where a Format As: was added to the Select Formatter option and CollectionObjectTypes were grouped by Format, is that initial problem solved?

If this extension could be more confusing and/or frustrating to work with, it might just be better to not include it in the first place.

What do you guys think?

Triggered by b34b627 on branch refs/heads/issue-6253
Previously if a QueryField was added, the last QueryField
would be scrolled to, regardless of where the new QueryField(s)
are inserted
@melton-jason melton-jason marked this pull request as ready for review April 2, 2025 20:57
@emenslin
Copy link
Collaborator

emenslin commented Apr 3, 2025

After some discussion I am also uncertain if this would be intuitive to users and I agree with @grantfitzsimmons in that I don't like that we're adding a filter to the query just because they select a format. I think this might be more confusing especially since we added the Format as: for COTs, as Jason mentioned. Looking back at the original issue though it seems like the main problem is that the existing filters are not working properly, is that going to be fixed in this PR? Although it looks like this filter could solve this issue, it seems like it might make more sense to find a more intuitive solution for the users.

Here is the original problem in production:

04-03_10.29.mp4

@grantfitzsimmons
Copy link
Member

During the development meeting on April 30, 2025, we discussed the lack of consensus on the usefulness of this PR. We are open to reintroducing these changes if our members demonstrate a need for them.

@github-project-automation github-project-automation bot moved this from 📋Back Log to ✅Done in General Tester Board Apr 30, 2025
@grantfitzsimmons grantfitzsimmons removed this from the 7.10.3 milestone Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Filter Collection Objects by COT formatter in Queries

7 participants