Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource-instance adv-search facet has misleading logic #11657

Open
whatisgalen opened this issue Nov 26, 2024 · 0 comments
Open

Resource-instance adv-search facet has misleading logic #11657

whatisgalen opened this issue Nov 26, 2024 · 0 comments

Comments

@whatisgalen
Copy link
Member

whatisgalen commented Nov 26, 2024

When your resource-instance node can reference multiple different instances (i.e. it's a resource-instance-list datatype), the advanced search lets you filter on specific references. See image:

Screenshot 2024-11-26 at 3 18 27 PM

If a user is searching for instances that refer to a set of instances, there's an implicit "AND", i.e. "I want resources that reference both A and B". However the way the search actually executes is an "OR", showing results that refer to either A or B or both.

This can be traced to the datatype-specific logic in ResourceInstanceDataType.append_search_filters() method here:

search_query = Terms(
    field="tiles.data.%s.resourceId.keyword" % (str(node.pk)),
    terms=value["val"],
 )

such that value["val"] is a list of resourceid strings for each "references" resource instance.

Suggested improvement:
We could rename the label "References" --> "References any of" and potentially create a new option for "References all of" to delineate the underlying "AND" vs "OR" choices.

This would save a user from creating an entirely new facet of the same node just to explicitly select the "AND"/"OR" in the UI (see image below)

Screenshot 2024-11-26 at 3 32 21 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant