Octopoos / SEBLOD

Build high-end websites with SEBLOD®, a CCK for Joomla!
https://www.seblod.com
GNU General Public License v2.0
129 stars 55 forks source link

Searches with regexp fails with CR in the fields #473

Open pulsarinformatique opened 7 years ago

pulsarinformatique commented 7 years ago

Hi

If you try to make a SEBLOD search on the introtext with (for example) the ART_keywords search generic field (or any field with the introtext storage) SEBLOD tries to perform a REGEX :

REGEXP "(::introtext::).token.(::/introtext::)" (granted you are searching for the keyword 'token')

but if you use JCE the content may have some CR characters and then the REGEXP FAILS to find the right contents.

just remove the CR manually (either from a non wysiwyg editor or though phpmyadmin) and the search works!

I think the REGEXP "(::introtext::).token.(::/introtext::)" should be modified into something that would accept CRs

Thanks

cyril

klas commented 7 years ago

problem is in the dot - it matches any character EXCEPT line break. adding /s modifier should solve this. (::introtext::).*token.*(::/introtext::)/s

pulsarinformatique commented 7 years ago

Hi Klas thanks for confirming it. We may expect a fix in a future release then

cyril

klas commented 7 years ago

yes, you are free to make a PR

pulsarinformatique commented 7 years ago

yes but I don't know which file is concerned :) YOU found the solution :)

cyril

klas commented 7 years ago

Most likely here https://github.com/Octopoos/SEBLOD/blob/master/plugins/cck_storage/custom/custom.php#L167 (I haven't tested it..)

pulsarinformatique commented 3 years ago

same issue appears if you have <p>&nbsp;</p> at the beginning and at the end of the introtext

pulsarinformatique commented 3 years ago

Octopoos, can you please fix this issue once for all ? the seblod search still doesn't work with regpexp on introtext or fulltext if there are CR inside

sebastienlapoux commented 3 years ago

Hi @pulsarinformatique ,

Please let us know if it concerns a field searched into a groupX or fieldX?

Please let us know if you try Klas fix?

Regards

pulsarinformatique commented 3 years ago

Hello The klas fix didn't solve the issue. And the issue has noth8ng to do with fieldx or groupx. It had yo do, as Klas mentioned, with the CR not being taken in the .* regexp