Skip to content

Conversation

shinde-rahul
Copy link
Contributor

@shinde-rahul shinde-rahul commented Dec 18, 2024

Q A
Bug fix? (use the a.b branch) 🔴
New feature/enhancement? (use the a.x branch) 🟢
Deprecations? 🔴
BC breaks? (use the c.x branch) 🔴
Automated tests included? 🟢
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description

Enabling Searching Contacts and Companies by Custom Field Values Without Field Alias Prefix

Problem Statement:
Currently, Mautic's search functionality only allows users to search for contacts or companies directly based on the values saved in custom fields, specifying the field alias and a colon (e.g., client_id:my-client-id).


📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull it down for testing locally (see docs on testing PRs here)
  2. Create custom fields for contacts and companies by enabling the Add to Search Index flag
  3. Create companies and contacts by adding data to the above-created custom field.
  4. Search by the custom field values for Contact
    1. Global search
    2. Contact listing page
  5. Search by the custom field values for Contact
    1. Company listing page

@shinde-rahul shinde-rahul added feature A new feature for inclusion in minor or major releases ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging custom-fields Anything related to custom fields search Issues relating to the search facility in Mautic labels Dec 18, 2024
@mautibot
Copy link
Contributor

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/enable-searching-contacts-and-companies-by-custom-field-values-without-field-alias-prefix/34430/4

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.21%. Comparing base (e7deb7c) to head (830da2c).
Report is 2 commits behind head on 6.x.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                6.x   #14393      +/-   ##
============================================
+ Coverage     64.19%   64.21%   +0.02%     
- Complexity    34563    34566       +3     
============================================
  Files          2268     2268              
  Lines        103251   103272      +21     
============================================
+ Hits          66278    66318      +40     
+ Misses        36973    36954      -19     
Files with missing lines Coverage Δ
...pp/bundles/LeadBundle/Entity/CompanyRepository.php 69.45% <100.00%> (+7.16%) ⬆️
...s/LeadBundle/Entity/CustomFieldRepositoryTrait.php 87.70% <100.00%> (+0.13%) ⬆️
app/bundles/LeadBundle/Entity/LeadField.php 96.59% <100.00%> (+0.05%) ⬆️
.../bundles/LeadBundle/Entity/LeadFieldRepository.php 66.03% <100.00%> (+1.34%) ⬆️
app/bundles/LeadBundle/Entity/LeadRepository.php 68.83% <100.00%> (+0.10%) ⬆️

... and 2 files with indirect coverage changes

@escopecz escopecz added this to the 6.0 milestone Dec 20, 2024
@escopecz escopecz added pending-feedback PR's and issues that are awaiting feedback from the author and removed ready-to-test PR's that are ready to test labels Dec 20, 2024
@shinde-rahul shinde-rahul removed the pending-feedback PR's and issues that are awaiting feedback from the author label Dec 23, 2024
@shinde-rahul shinde-rahul added the ready-to-test PR's that are ready to test label Dec 24, 2024
Copy link
Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

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

I noticed 2 more small possible improvements

Co-authored-by: John Linhart <jan@linhart.email>
@RCheesley RCheesley modified the milestones: 6.0.0-alpha, 6.0.0-beta Jan 27, 2025
@Bastian2718
Copy link

For Contacts it looks good and works but for companies I can't even create a custom Field.
image
Independent what the settings are (at least for the two setting options mentioned). Can't create even if the in "Indexable" setting is off.

@kuzmany
Copy link
Member

kuzmany commented Feb 6, 2025

I think @andersonjeccel suggestion is very correct. Now we will have indexable and searchable. Almost same toggle.
it's really hard not dev people explain what toggles do.
I would keep only Indexable and rename it to Available in search.

Indexable is dev term, we shouldn't use it.

@escopecz
Copy link
Member

escopecz commented Feb 6, 2025

I agree that this is too technical configuration to have in the UI. I was playing with an idea to configure the indexes automatically based on the usage in the segment filters but my teammates didn't like the idea. It also couldn't work for other areas like search or repeating API queries.

I like the idea that Zdeno described. Perhaps 1 toggle is all we need.

@shinde-rahul
Copy link
Contributor Author

Okay. I'll update the code to have one flag instead of two. Thanks.

@shinde-rahul
Copy link
Contributor Author

@escopecz @kuzmany @andersonjeccel, please review the changes.

@shinde-rahul shinde-rahul requested a review from kuzmany February 7, 2025 09:42
@@ -279,7 +278,8 @@ mautic.lead.field.form.properties.lookup="Lookup values"
mautic.lead.field.form.properties.numberprecision="Precision"
mautic.lead.field.form.properties.numberrounding="Rounding mode"
mautic.lead.field.form.properties.select="Options"
mautic.lead.field.form.isIndex.tooltip="Making this field indexable may improve search performance. %indexCount% indexes out of %maxCount% have been used."
mautic.lead.field.indexable="Add to Search Index"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
mautic.lead.field.indexable="Add to Search Index"
mautic.lead.field.indexable="Available in Search "

@andersonjeccel, Please help me with the label.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is better - available in search sounds good.

Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

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

I'm experiencing the same as @Bastian2718 when creating a company custom field with this setting - it does not happen with the default 6.x branch, only with this PR applied.

@shinde-rahul
Copy link
Contributor Author

@RCheesley, I have updated the branch with 6.x.

Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

Works as expected.
Code looks good to me too 👍

@andersonjeccel andersonjeccel added code-review-passed PRs which have passed code review user-testing-passed PRs which have been successfully tested by the required number of people. ux-review-passed and removed ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging labels Feb 19, 2025
Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

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

The bug I experienced is gone now so this is good to go.

@RCheesley RCheesley added the ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged label Feb 21, 2025
@RCheesley RCheesley merged commit 05787be into mautic:6.x Feb 21, 2025
17 checks passed
@RCheesley RCheesley modified the milestones: 6.0.0-beta, 6.0.0-beta2 Mar 5, 2025
@mautibot
Copy link
Contributor

mautibot commented Mar 6, 2025

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/announcing-mautic-6-beta-now-available-for-testing/35196/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review custom-fields Anything related to custom fields feature A new feature for inclusion in minor or major releases ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged search Issues relating to the search facility in Mautic user-testing-passed PRs which have been successfully tested by the required number of people. ux-review-passed
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

7 participants