Forums

search with OR and not AND

webcrea 23 Mar, 2017
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
Max_admin 23 Mar, 2017
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
webcrea 24 Mar, 2017
Super
Thanks a lot
NickOg 13 Oct, 2018
HI
Further to this - how can I modify the query so:
​[pre](
Model.firstname/LIKE:%{data:firstname}%[br]AND[br]Model.lastname/LIKE:%{data:lastname}%[br])[br]OR[br]Model.address/LIKE:%{data:address}%[/pre]
[br]​
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 14 Oct, 2018
Hi,

do you try this ?

(
Model.firstname/LIKE:%{data:firstname}%
Model.lastname/LIKE:%{data:lastname}%
)
OR
Model.address/LIKE:%{data:address}%
healyhatman 14 Oct, 2018
(
Model.firstname/LIKE:%{data:firstname}%
AND
Model.lastname/LIKE:%{data:lastname}%
)/-
OR
Model.address/LIKE:%{data:address}%/-
NickOg 14 Oct, 2018
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
This topic is locked and no more replies can be posted.