Forums

How to search exactly

goliath 25 Jun, 2015
I have a search function in my CC listing that works fine.
Let's say I want to search for eg. 'de wolf'. If I insert this (without the '-s), all the records with 'de' and/or 'wolf' are shown. But how can I search only the records with 'de wolf'? I tried to search for "de wolf" (with the "-s) but then nothing is shown.
Max_admin 03 Jul, 2015
Yes, "de wolf" should work, with the quotes, you can enable the debug in your connection to check the query or post it here so we can check if it works as expected!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
goliath 13 Jul, 2015
Results from the debugger:

for de wolf:
`Modelname`.`id` LIKE '%de%' OR 
`Modelname`.`voornaam` LIKE '%de%' OR 
`Modelname`.`achternaam` LIKE '%de%' OR 
`Modelname`.`organisatienaam` LIKE '%de%' OR 
`Modelname`.`id` LIKE '%wolf%' OR 
`Modelname`.`voornaam` LIKE '%wolf%' OR 
`Modelname`.`achternaam` LIKE '%wolf%' OR 
`Modelname`.`organisatienaam` LIKE '%wolf%'

----------
for"de wolf"
`Modelname`.`id` LIKE '%de wolf%' AND 
`Modelname`.`voornaam` LIKE '%de wolf%' AND 
`Modelname`.`achternaam` LIKE '%de wolf%' AND 
`Modelname`.`organisatienaam` LIKE '%de wolf%'
Max_admin 17 Jul, 2015
So it works as expected when you use "de wolf", you just need to set the searchable fields to one field only, not all of of them.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
goliath 17 Jul, 2015
So this means that if you use the " " , you can only search in one field?
Is this logical?

What if I want to search for "de wolf" in more than one field (the value can either be in 'voornaam', 'achternaam' or 'organisatienaam')?
Max_admin 19 Jul, 2015
Answer
I agree with you, but the current code will try to match " " strings in ALL fields which is wrong, so a fix will be needed, you can send me a message using the "Contact us" page to get a patch file.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.