All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Low Search showing EE comments

James Turner 3 Jul 2018 14:45 problem, pending

Hi, Low Search seems to be indexing EE comments. Here is an example of a search that has EE comments in it's result: https://www.a2hosting.com/kb/results/...

Is there a way to strip EE comments?

Replies

  1. James Turner 3 Jul 2018 15:13

    I was able to fix it by adding the following to line 1564 of filters/keywords/lsf.keywords.php

    $str = ee()->TMPL->remove_ee_comments($str);

    It looks like html_format => 'safe' causes the closing --} to become an –}

    James Turner 3 Jul 2018 15:49

    I've taken this fix live on our end so you can no longer see the example behavior I mentioned above.

  2. Low 3 Jul 2018 20:43

    Does this mean you have EE comments in your Channel Entry's content?

    Also, for the record, what are your EE and LS versions?

  3. James Turner 3 Jul 2018 20:46

    Correct, some of our content editors have left themselves notes via EE comments in the Channel Entry's content.

    We are on 3.5.16 of EE and 5.2.0 of Low Search.

  4. Low 3 Jul 2018 20:50

    Were the contents of the comments shown in the search excerpt or was just the entry returned when the keywords matched the comments?

    For the latter, what kind of field contains the comments and what formatting is set for those fields?

  5. James Turner 3 Jul 2018 20:53

    The actual comment was showing in the search except.

  6. Low 3 Jul 2018 20:56

    Okay. Will look into it and decide on a native fix.

  7. Low 5 Jul 2018 06:56

    Still need some more info to tackle this properly. What kind of field have you set as the excerpt field (which contains the comments) and what formatting is set for those fields?

    For now, a regular textarea field set to EE's XHTML format will leave the EE comments alone so it is stripped away by EE's template parser. However, if you set the same field to Markdown, double dashes are replaced with n-dashes, so EE's template parser doesn't pick up on the comments.

    Then there's the question whether EE tags (so comments and other curly-braces tags) should be parsed in content at all in the first place. I don't think you're able to use any {exp:...} tags or early-parsed vars like {segment_1}, while late-parsed global vars like {site_name} are replaced.

    Low Search's excerpt field tries to mimic native behaviour as much as possible, so I try to use that as a guideline.

    Coming back to your issue; if you parse the excerpt field directly (so not using {low_search_excerpt} but using the field's short name {field_name} instead), do you see the comment too? Or just when you use the excerpt variable?