Hi,
My setup is a simple search api views (search api solr as backend). 2 fields: node title and body field. Keyword search is exposed.
Example:
The main body text contains "This is a test", in which the word "test" is a hyperlink to www.test.com - html format: "This is a <a href="www.test.com">test</a>".
When you search for "test" keyword, if the "test" in the above string is not a hyperlink, highlighting works fine, the word "test" is in bold. But if the word "test" is a hyperlink as described above, the href record "www.test.com" is also altered. It will become something like href="www.<strong>test</strong>.com" which messes up the hyper link.
Does anyone know how to sort this out? Maybe force the highlight processor to ignore href part?
Many thanks,
Long
Comments
Comment #1
longmtran commentedComment #2
longmtran commentedComment #3
longmtran commentedComment #4
drunken monkeyThanks for reporting this issue!
It seems we totally overlooked that when adding the Highlighting processor. Please see whether the attached patch fixes the problem!
Also, please read and respect the issue tag guidelines. Short summary: don't use them.
Comment #6
drunken monkeyComment #7
drunken monkeyRe-attaching because test bot is stupid (or too clever).
Comment #9
drunken monkeyOh, OK, it isn't. Since I just committed a follow-up to #2168713: Warning: preg_match(): Unknown modifier '(' in SearchApiHighlight->createExcerpt() it seems this needed a re-roll. Patch attached!
Comment #10
drunken monkeyComment #13
drunken monkeyNeeds to be ported to D8.
Comment #14
drunken monkeyComment #15
rosinegrean commentedComment #16
rosinegrean commentedI was not able to test this, due some errors, but the patch is straight forward.
I'll debug those errors separately.
Comment #22
drunken monkeyI can reproduce the test fails locally, though I cannot see what could cause them, either. But the patch definitely breaks the highlight tests.
Comment #23
mashermike commentedThe updated call to the highlightField function was passing the wrong variable.
Comment #24
rosinegrean commentedYes, you are right @mashermike.
This looks good now.
Comment #26
drunken monkeyLooks great, thanks a lot!
Committed.