Mautic Community Forums

Contact search does not work with more then one alias

Your software
My Mautic version is: 3.3.4
My PHP version is: 7.3
My Database type and version is: Maria DB 10.3.30

Your problem
My problem is:

I was experimenting with contact search on mautic_contact_index and it appears that AND/OR operators are not working (I am not able to get any hits by search even though there should be some),

I investigated further and it turns out search was only working as I expected once I put only one field (alias) into the search bar. For example this worked:

firstname:%exam%

and these did not:

(email:%exam%) OR (firstname:%exam%)
email:%exam% OR firstname:%exam%
email:%exam% firstname:%exam%
email:%exam% || firstname:%exam%
email:%exam% | firstname:%exam%

I also tried something similar to this (note that email & firstname are different in this case):
(email:%exam%) OR (firstname:%examb%)
email:%exam% OR firstname:%examb%
email:%exam% firstname:%examb%
email:%exam% || firstname:%examb%
email:%exam% | firstname:%examb%

Notes

  • When I searched only by one alias at the time, I was able to get records back.
  • I tried this on instance 3.3.4 & 4.0.0 both behaved the same - it worked for one alias but did not work for multiple and it did not work once I included OR operator.

Question: Before I go diving deep into the Mautic Core is there something obvious I am doing wrong.

These errors are showing in the log:

[No errors]

Steps I have tried to fix the problem:

[See the above examples I tried.]

Any help is greatly appreciated.

Temporarily I solved this by adding new field where I have combined value from each field (first & last name, email and a couple of custom field) into new field. When search is triggered without specific filter I just alter the search string by adding “newfield:” and the string I am after.

It would be good to know how to get expressions working in the search bar though.

I can confirm I have tested this in 3.x and in 4.0.1 and I am getting the same behaviour as described above