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

dev/core#1321 - SearchKit - Limit operator list for array fields #26068

Merged
merged 1 commit into from
May 16, 2023

Conversation

colemanw
Copy link
Member

Overview

Implements suggestion from https://lab.civicrm.org/dev/core/-/issues/1321#note_58735 to limit operators in SearchKit for fields that store array data.

Before

Searching on an array field like "Contact Subtype" is confusing in SearchKit, as the default "=" operator doesn't work as expected.

After

Default is now "CONTAINS" which correctly searches within arrays. Only sensible operators are available.

image

@civibot
Copy link

civibot bot commented Apr 15, 2023

No issue was found matching the number given in the pull request title. Please check the issue number.

@civibot
Copy link

civibot bot commented Apr 15, 2023

(Standard links)

@civibot civibot bot added the master label Apr 15, 2023
@larssandergreen
Copy link
Contributor

I have reviewed, makes sense in general, code looks good, r-run works.

The only question I have is about field.data_type === 'Array'. It looks to me like the options for arrays are Is One Of / Not One Of (e.g. for In Groups, With Tags). So maybe we should only do this for serialized fields? To be clear, it works as expected for everything I can think of (I can't find any other array fields other than In Groups and With Tags), but maybe this would be confusing or potentially have other consequences.

@larssandergreen
Copy link
Contributor

Just added a related issue to add NOT CONTAINS to API and SK.

@colemanw
Copy link
Member Author

Merging per review. Thanks @larssandergreen
We'll address follow-up in your other issue.

@colemanw colemanw merged commit 2253c15 into civicrm:master May 16, 2023
@colemanw colemanw deleted the arrayOperators branch May 16, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants