Hello!
I use 2 processors: html_filter and highlight on my website. Order of these processors is:
- html_filter
- highlight
My highlight processor adds the prefix
<strong class="highlighting-keywords">
and suffix
</srong>
around keywords.
When I search a word "test" on my website, I see many <strong>
tags on a search result page, i.e.
<h3>This is a <strong><strong class="highlighting-keywords">test</strong></strong> title of node</h3>
- Solr sends search results with the tag strong around keywords
- Then highlight processor calls check_plain and adds the tag strong around keywords.
I see the function getFulltextFields() calls search_api_get_sanitized_field_values() and use check_plain() for search result.
It is very security, but users see many tags on the search result page. Maybe we will strip all tags?
Comment | File | Size | Author |
---|---|---|---|
#7 | 2772199-7--solr_highlight_clarification.patch | 1.62 KB | drunken monkey |
Comments
Comment #2
mikhailkrainiuk CreditAttribution: mikhailkrainiuk at DrupalJedi commentedComment #3
mikhailkrainiuk CreditAttribution: mikhailkrainiuk at DrupalJedi commentedI see a Solr server sends result without tags, except tag
<strong>
around keywords.If highlight processor adds
<strong>
tags around keywords, we can strip all other tags from search results.There is a patch to strip tags in search results before highlight words. Review it, please.
Comment #4
mikhailkrainiuk CreditAttribution: mikhailkrainiuk at DrupalJedi commentedComment #5
drunken monkeyIf you've configured Solr to highlight your field values, don't also use the "Highlight" processor. It's either one or the other.
Please try with only Solr and report back whether that works.
PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by module maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty.
Comment #6
drunken monkeySince a lot of people reported this problem over the years, maybe it's time to add a note to the description of the server option to point this out.
Comment #7
drunken monkeyCould someone please give this a short look and tell me if they think the phrasing is OK? Then I can commit and hopefully keep some people from making this mistake in the future.
Comment #8
Sardis CreditAttribution: Sardis at Drupal Ukraine Community for Drupal Ukraine Community commented@drunken_monkey
Looks good to me.
Comment #10
drunken monkeyGood to hear, thanks for reviewing!
Committed.