Buy Now
Sign in

search with OR and not AND

webcrea , March 23 2017, 09:11
webcrea 582
March 23 2017, 09:11 #366153
Hi,
cc6 build search with AND when several fields are indicate in "Searchable fields". In this case nothing appears in result,
Is it possible to build the query with OR ?
Thanks
Christophe
http://www.webcrea.fr
admin 27
March 23 2017, 19:37 #366184
 Answer
Hi Chris,

Yes, but you will need to add the fields in the "where conditions" instead and remove them from the "searchable fields".


Model.field1/LIKE:%{data:keywords}%
OR
Model.field2/LIKE:%{data:keywords}%
OR
Model.field3/LIKE:%{data:keywords}%


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
webcrea 582
March 24 2017, 08:55 #366194
Super
Thanks a lot
Christophe
http://www.webcrea.fr
NickOg 786
October 13 2018, 20:23 #380771
HI
Further to this - how can I modify the query so:
(
Model.firstname/LIKE:%{data:firstname}%
AND
Model.lastname/LIKE:%{data:lastname}%
)
OR
Model.address/LIKE:%{data:address}%

I can't seem to force those enclosing (). I have tried 'escaping' them /( and /) with no success. Do I need to resort to PHP?????
Regards
Nick
webcrea 582
October 14 2018, 07:21 #380772
Hi,
do you try this ?
(
Model.firstname/LIKE:%{data:firstname}%
Model.lastname/LIKE:%{data:lastname}%
)
OR
Model.address/LIKE:%{data:address}%
Christophe
http://www.webcrea.fr
healyhatman 7
October 14 2018, 10:52 #380777
(
Model.firstname/LIKE:%{data:firstname}%
AND
Model.lastname/LIKE:%{data:lastname}%
)/-
OR
Model.address/LIKE:%{data:address}%/-
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
NickOg 786
October 14 2018, 19:18 #380781
Thanks Gents. I can get Christophe's solution to work just fine but not that from HealyHatman.
Pretty sure that I have the syntax copied correctly:-
(
mdlCheckName.lastname/LIKE:{data:lastname}%
AND
mdlCheckName.firstname/LIKE:{data:firstname}%
)/-
OR
mdlCheckName.street/LIKE:{data:address}%/-
I am just checking that some more.
Regards
Nick