Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested MODX tags are not removed from extract correctly #20

Open
Boddlnagg opened this issue Oct 2, 2015 · 5 comments
Open

Nested MODX tags are not removed from extract correctly #20

Boddlnagg opened this issue Oct 2, 2015 · 5 comments

Comments

@Boddlnagg
Copy link

When there are MODX tags in the result extract, they are filtered out, but if these tags contain other tags, e.g. [[!foo? &blah=[[!+ph? &blah=Value]] &bar=Value]], the parameters of the outer tag after the first ]] are shown in the extract, which results in the following to be visible to users in the search results: &bar=`Value

It does not happen in all cases, but I could reproduce it when the inner tag was either an uncached placeholder ([[!+...]]) or a ressource content field ([[*...]]).

@hugopeek
Copy link

Can confirm that it happens when a nested tag contains a [[*...]] field.

@jopberkhout
Copy link

I'm am experiencing this as well with our MODX site: https://ctmeter.nl/algemeen/zoekresultaten?search=downloads&id=319. As @hugopeek says, it happens when a nested tag contains a [[*...]] field.
schermafbeelding 2016-06-01 om 16 41 08

@Mark-H
Copy link

Mark-H commented Oct 12, 2016

Maybe applying an output filter to the extract that strips out MODX tags can help? Kind of a tricky problem though.

@hugopeek
Copy link

hugopeek commented Dec 1, 2016

Thanks for the suggestion @Mark-H. I circumvented it a little by loading the introtext instead, if the extract contains the string =`:

[[[[+extract:contains=`=``:then=`+introtext:stripTags=`span``:else=`+extract`]]]]

Not an ideal / permanent solution though..

@tillilab
Copy link

I'm having same issue, maybe adding an option to do a major cleanup of content?

for example in model/simplesearch/simplesearch.class.php

add in the createextract function, just after sanitize:

$regx = '/[\w\W^]+/i'; // strip anything between ticks including ticks (``)
$text = preg_replace( $regx, '', $text );
$regx = '/&(amp;)?[a-zA-Z0-9_-.?^=]+=/i'; // strip remaining tag qualifiers ( &tag= )
$text = preg_replace( $regx, '', $text );
`
I took the idea/code from this post https://forums.modx.com/thread/87390/strip-modx-tags-from-simplesearch-results#dis-post-533583

matdave pushed a commit that referenced this issue Jul 25, 2022
…-fix

Pagination fix when using faceted search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants