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.
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.
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
Regards,
Max
Results from the debugger:
for de wolf:
----------
for"de wolf"
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%'
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.
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')?
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')?
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.
This topic is locked and no more replies can be posted.