# Contact search does not work with more then one alias

**URL:** <https://forum.mautic.org/t/contact-search-does-not-work-with-more-then-one-alias/21201>\
**Category:** Product Support\
**Created:** [October 8, 2021, 8:32pm UTC](https://forum.mautic.org/t/contact-search-does-not-work-with-more-then-one-alias/21201 "2021-10-08T20:32:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [October 8, 2021, 8:32pm UTC](https://forum.mautic.org/t/contact-search-does-not-work-with-more-then-one-alias/21201/1 "2021-10-08T20:32:14Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [October 14, 2021, 3:17pm UTC](https://forum.mautic.org/t/contact-search-does-not-work-with-more-then-one-alias/21201/2 "2021-10-14T15:17:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [October 18, 2021, 7:35am UTC](https://forum.mautic.org/t/contact-search-does-not-work-with-more-then-one-alias/21201/3 "2021-10-18T07:35:33Z")

</div>

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
